private static void ApplyParentTransform(SpriterSpatialInfo child, SpriterSpatialInfo parent)
        {
            float px = parent.ScaleX * child.X;
            float py = parent.ScaleY * child.Y;
            double angleRad = parent.Angle * Math.PI / 180;
            float s = (float)Math.Sin(angleRad);
            float c = (float)Math.Cos(angleRad);

            child.X = px * c - py * s + parent.X;
            child.Y = px * s + py * c + parent.Y;
            child.ScaleX *= parent.ScaleX;
            child.ScaleY *= parent.ScaleY;
            child.Angle = parent.Angle + Math.Sign(parent.ScaleX * parent.ScaleY) * child.Angle;
            child.Angle %= 360.0f;
        }
Exemplo n.º 2
0
 private static SpriterSpatialInfo Interpolate(SpriterSpatialInfo a, SpriterSpatialInfo b, float f, int spin)
 {
     return new SpriterSpatialInfo
     {
         Angle = AngleLinear(a.Angle, b.Angle, spin, f),
         X = Linear(a.X, b.X, f),
         Y = Linear(a.Y, b.Y, f),
         ScaleX = Linear(a.ScaleX, b.ScaleX, f),
         ScaleY = Linear(a.ScaleY, b.ScaleY, f)
     };
 }
Exemplo n.º 3
0
 private static void FillFrom(SpriterSpatialInfo target, SpriterSpatialInfo source)
 {
     target.Alpha = source.Alpha;
     target.Angle = source.Angle;
     target.ScaleX = source.ScaleX;
     target.ScaleY = source.ScaleY;
     target.X = source.X;
     target.Y = source.Y;
 }
Exemplo n.º 4
0
 private static SpriterSpatialInfo Copy(SpriterSpatialInfo info)
 {
     SpriterSpatialInfo copy = new SpriterSpatialInfo();
     FillFrom(copy, info);
     return copy;
 }