public static EasingTypes GetReverseEasing(EasingTypes easing)
        {
            var s = easing.ToString();

            var contain_in  = s.Contains("In");
            var contain_out = s.Contains("Out");

            if (contain_in ^ contain_out)
            {
                var x = s;

                if (contain_in)
                {
                    x = x.Replace("In", "Out");
                }

                if (contain_out)
                {
                    x = x.Replace("Out", "In");
                }

                return(Enum.TryParse(x, out EasingTypes r) ? r : EasingTypes.None);
            }

            return(easing);
        }
Exemple #2
0
        public virtual void moveY(EasingTypes easing, int startTime, int endTime, double startY, double endY)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
            {
                throw new CompilerException(-1, 315, easing.ToString());
            }
            var startParams = new[] { startY };
            var endParams   = new[] { endY };

            AddCommand(new Animation(AnimationType.MoveY, easing, startTime, endTime, startParams, endParams));
            this.y = (int)endY;
        }
Exemple #3
0
        public virtual void rotate(EasingTypes easing, int startTime, int endTime, double startAngle, double endAngle)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
            {
                throw new CompilerException(-1, 315, easing.ToString());
            }
            var startParams = new[] { startAngle };
            var endParams   = new[] { endAngle };

            AddCommand(new Animation(AnimationType.Rotate, easing, startTime, endTime, startParams, endParams));
            rotation = endAngle;
        }
Exemple #4
0
        public virtual void fade(EasingTypes easing, int startTime, int endTime, double startOpacity, double endOpacity)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
            {
                throw new CompilerException(-1, 315, easing.ToString());
            }
            var startParams = new[] { startOpacity };
            var endParams   = new[] { endOpacity };

            AddCommand(new Animation(AnimationType.Fade, easing, startTime, endTime, startParams, endParams));
            opacity = endOpacity;
        }
Exemple #5
0
        public virtual void scaleVec(EasingTypes easing, int startTime, int endTime, double startX, double startY, double endX,
                                     double endY)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
            {
                throw new CompilerException(-1, 315, easing.ToString());
            }
            var startParams = new[] { startX, startY };
            var endParams   = new[] { endX, endY };

            AddCommand(new Animation(AnimationType.ScaleVec, easing, startTime, endTime, startParams, endParams));
            this.scaleFactor = (endX + endY) / 2;
        }
Exemple #6
0
        public virtual void color(EasingTypes easing, int startTime, int endTime, int startRed, int startGreen, int startBlue,
                                  int endRed, int endGreen, int endBlue)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
            {
                throw new CompilerException(-1, 315, easing.ToString());
            }
            var startParams = new double[] { startRed, startGreen, startBlue };
            var endParams   = new double[] { endRed, endGreen, endBlue };

            AddCommand(new Animation(AnimationType.Color, easing, startTime, endTime, startParams, endParams));
            red   = endRed;
            green = endGreen;
            blue  = endBlue;
        }
        public virtual void scaleVec(EasingTypes easing, int startTime, int endTime, double startX, double startY, double endX,
							 double endY)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
                throw new CompilerException(-1, 315, easing.ToString());
            var startParams = new[] { startX, startY };
            var endParams = new[] { endX, endY };
            AddCommand(new Animation(AnimationType.ScaleVec, easing, startTime, endTime, startParams, endParams));
            this.scaleFactor = (endX + endY) / 2;
        }
 public virtual void rotate(EasingTypes easing, int startTime, int endTime, double startAngle, double endAngle)
 {
     if (!Enum.IsDefined(typeof(EasingTypes), easing))
         throw new CompilerException(-1, 315, easing.ToString());
     var startParams = new[] { startAngle };
     var endParams = new[] { endAngle };
     AddCommand(new Animation(AnimationType.Rotate, easing, startTime, endTime, startParams, endParams));
     rotation = endAngle;
 }
 public virtual void moveY(EasingTypes easing, int startTime, int endTime, double startY, double endY)
 {
     if (!Enum.IsDefined(typeof(EasingTypes), easing))
         throw new CompilerException(-1, 315, easing.ToString());
     var startParams = new[] { startY };
     var endParams = new[] { endY };
     AddCommand(new Animation(AnimationType.MoveY, easing, startTime, endTime, startParams, endParams));
     this.y = (int)endY;
 }
 public virtual void fade(EasingTypes easing, int startTime, int endTime, double startOpacity, double endOpacity)
 {
     if (!Enum.IsDefined(typeof(EasingTypes), easing))
         throw new CompilerException(-1, 315, easing.ToString());
     var startParams = new[] { startOpacity };
     var endParams = new[] { endOpacity };
     AddCommand(new Animation(AnimationType.Fade, easing, startTime, endTime, startParams, endParams));
     opacity = endOpacity;
 }
        public virtual void color(EasingTypes easing, int startTime, int endTime, int startRed, int startGreen, int startBlue,
						  int endRed, int endGreen, int endBlue)
        {
            if (!Enum.IsDefined(typeof(EasingTypes), easing))
                throw new CompilerException(-1, 315, easing.ToString());
            var startParams = new double[] { startRed, startGreen, startBlue };
            var endParams = new double[] { endRed, endGreen, endBlue };
            AddCommand(new Animation(AnimationType.Color, easing, startTime, endTime, startParams, endParams));
            red = endRed;
            green = endGreen;
            blue = endBlue;
        }