Esempio n. 1
0
 public Ellipse(
     string name,
     string matchName,
     bool direction,
     IAnimatableVector3 position,
     IAnimatableVector3 diameter)
     : base(name, matchName)
 {
     Direction = direction;
     Position  = position;
     Diameter  = diameter;
 }
Esempio n. 2
0
 public RepeaterTransform(
     string name,
     IAnimatableVector3 anchor,
     IAnimatableVector3 position,
     IAnimatableVector3 scalePercent,
     Animatable <double> rotationDegrees,
     Animatable <double> opacityPercent,
     Animatable <double> startOpacityPercent,
     Animatable <double> endOpacityPercent)
     : base(name, anchor, position, scalePercent, rotationDegrees, opacityPercent)
 {
     StartOpacityPercent = startOpacityPercent;
     EndOpacityPercent   = endOpacityPercent;
 }
Esempio n. 3
0
 public Rectangle(
     string name,
     string matchName,
     bool direction,
     IAnimatableVector3 position,
     IAnimatableVector3 size,
     Animatable <double> cornerRadius)
     : base(name, matchName)
 {
     Direction    = direction;
     Position     = position;
     Size         = size;
     CornerRadius = cornerRadius;
 }
Esempio n. 4
0
 public Transform(
     string name,
     IAnimatableVector3 anchor,
     IAnimatableVector3 position,
     IAnimatableVector3 scalePercent,
     Animatable <double> rotationDegrees,
     Animatable <double> opacityPercent)
     : base(name, string.Empty)
 {
     Anchor          = anchor;
     Position        = position;
     ScalePercent    = scalePercent;
     RotationDegrees = rotationDegrees;
     OpacityPercent  = opacityPercent;
 }
 public RadialGradientFill(
     string name,
     string matchName,
     Animatable <double> opacityPercent,
     IAnimatableVector3 startPoint,
     IAnimatableVector3 endPoint,
     Animatable <Sequence <GradientStop> > gradientStops,
     Animatable <double> highlightLength,
     Animatable <double> highlightDegrees)
     : base(name, matchName)
 {
     OpacityPercent   = opacityPercent;
     StartPoint       = startPoint;
     EndPoint         = endPoint;
     GradientStops    = gradientStops;
     HighlightLength  = highlightLength;
     HighlightDegrees = highlightDegrees;
 }
Esempio n. 6
0
        XObject FromAnimatable(string name, IAnimatableVector3 animatable)
        {
            switch (animatable.Type)
            {
            case AnimatableVector3Type.Vector3:
                return(FromAnimatable <Vector3>(name, (AnimatableVector3)animatable));

            case AnimatableVector3Type.XYZ:
            {
                var xyz = (AnimatableXYZ)animatable;
                return(new XElement(
                           name,
                           FromAnimatable(nameof(xyz.X), xyz.X),
                           FromAnimatable(nameof(xyz.Y), xyz.Y),
                           FromAnimatable(nameof(xyz.Z), xyz.Z)));
            }

            default:
                throw Unreachable;
            }
        }
Esempio n. 7
0
        MergeResult <IAnimatableVector3> MergeIAnimatableVector3(IAnimatableVector3 a, TimeRange aRange, IAnimatableVector3 b, TimeRange bRange)
        {
            if (a is AnimatableVector3 && b is AnimatableVector3)
            {
                var res = MergeAnimatable((AnimatableVector3)a, aRange, (AnimatableVector3)b, bRange);
                if (!res.Success)
                {
                    return(MergeResult <IAnimatableVector3> .Failed);
                }

                AnimatableVector3 resVector3;
                if (res.Value !.IsAnimated)
                {
                    resVector3 = new AnimatableVector3(res.Value.KeyFrames);
                }
                else
                {
                    resVector3 = new AnimatableVector3(res.Value.InitialValue);
                }

                return(new MergeResult <IAnimatableVector3>(resVector3));
            }
        YamlObject FromAnimatable(IAnimatableVector3 animatable)
        {
            switch (animatable.Type)
            {
            case AnimatableVector3Type.Vector3:
                return(FromAnimatable <Vector3>((AnimatableVector3)animatable, FromVector3));

            case AnimatableVector3Type.XYZ:
            {
                var xyz    = (AnimatableXYZ)animatable;
                var result = new YamlMap
                {
                    { "X", FromAnimatable(xyz.X) },
                    { "Y", FromAnimatable(xyz.Y) },
                    { "Z", FromAnimatable(xyz.Z) },
                };
                return(result);
            }

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 9
0
        YamlObject FromAnimatable(IAnimatableVector3 animatable)
        {
            switch (animatable.Type)
            {
            case AnimatableVector3Type.Vector3:
                return(FromAnimatable <Vector3>((AnimatableVector3)animatable, FromVector3));

            case AnimatableVector3Type.XYZ:
            {
                var xyz    = (AnimatableXYZ)animatable;
                var result = new YamlMap
                {
                    { nameof(xyz.X), FromAnimatable(xyz.X) },
                    { nameof(xyz.Y), FromAnimatable(xyz.Y) },
                    { nameof(xyz.Z), FromAnimatable(xyz.Z) },
                };
                return(result);
            }

            default:
                throw Unreachable;
            }
        }
Esempio n. 10
0
        public static IAnimatableVector2 WithoutZ(this IAnimatableVector3 animatableVector3)
        {
            switch (animatableVector3.Type)
            {
            case AnimatableVector3Type.Vector3:
            {
                var v3 = (AnimatableVector3)animatableVector3;
                return(v3.IsAnimated
                            ? new AnimatableVector2(v3.KeyFrames.Select(
                                                        kf => new KeyFrame <Vector2>(kf.Frame, new Vector2(kf.Value.X, kf.Value.Y), kf.Easing)))
                            : new AnimatableVector2(new Vector2(v3.InitialValue.X, v3.InitialValue.Y)));
            }

            case AnimatableVector3Type.XYZ:
            {
                var vxyz = (AnimatableXYZ)animatableVector3;
                return(new AnimatableXY(vxyz.X, vxyz.Y));
            }

            default:
                throw Exceptions.Unreachable;
            }
        }
Esempio n. 11
0
 public Polystar(
     string name,
     string matchName,
     bool direction,
     PolyStarType starType,
     Animatable <double> points,
     IAnimatableVector3 position,
     Animatable <double> rotation,
     Animatable <double> innerRadius,
     Animatable <double> outerRadius,
     Animatable <double> innerRoundedness,
     Animatable <double> outerRoundedness)
     : base(name, matchName)
 {
     Direction        = direction;
     StarType         = starType;
     Points           = points;
     Position         = position;
     Rotation         = rotation;
     InnerRadius      = innerRadius;
     OuterRadius      = outerRadius;
     InnerRoundedness = innerRoundedness;
     OuterRoundedness = outerRoundedness;
 }
Esempio n. 12
0
 /// <summary>
 /// If the given <see cref="IAnimatableVector3"/> is an <see cref="AnimatableVector3"/> with multiple
 /// easings, returns an equivalent <see cref="AnimatableXYZ"/> with one easing per channel.
 /// </summary>
 /// <returns>An equivalent <see cref="IAnimatableVector3"/> with only one easing per
 /// channel.</returns>
 internal static IAnimatableVector3 EnsureOneEasingPerChannel(IAnimatableVector3 animatableVector3) =>
 animatableVector3 is AnimatableVector3 value?EnsureOneEasingPerChannel(value) : animatableVector3;
 internal TrimmedAnimatable <Vector3> TrimAnimatable(IAnimatableVector3 animatable)
 {
     return(TrimAnimatable <Vector3>((AnimatableVector3)animatable));
 }
Esempio n. 14
0
 public static TrimmedAnimatable <Vector3> TrimAnimatable(LayerContext context, IAnimatableVector3 animatable)
 => TrimAnimatable <Vector3>(context, (AnimatableVector3)animatable);