예제 #1
0
        protected virtual void onAnimationFinished()
        {
            AnimationFinishedHandler handler = AnimationFinishedEvent;

            if (handler != null)
            {
                handler(this, null);
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Animation"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="target">The target.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="callback">The callback.</param>
        /// <param name="startValue">The start value.</param>
        /// <param name="timerInterval">The timer interval.</param>
        /// <param name="timePassed">The time passed.</param>
        /// <param name="reversed_duration">Duration of the reversed.</param>
        /// <param name="reversed_timePassed">The reversed time passed.</param>
        public LocationAnimation(AnimationTypes type, object target, float offset, float mover, AnimationFinishedHandler handler, int duration, AnimationCallback callback, int startValue, int timerInterval, int timePassed, int reversed_duration, int reversed_timePassed)
        {
            this.type              = type;
            this.target            = target;
            this.offset            = offset;
            this.handler           = handler;
            this.duration          = duration;
            this.reversed_duration = reversed_duration;
            this.mover             = mover;

            // timings in ms
            this.interval            = timerInterval;
            this.timePassed          = timePassed;
            this.reversed_timePassed = reversed_timePassed;

            Control c;

            System.Windows.Forms.Form f;

            switch (type)
            {
            case AnimationTypes.MoveLeft:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Location.X;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }

                break;

            case AnimationTypes.MoveUp:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Location.Y;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.MoveRight:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Location.X;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.MoveDown:

                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Location.Y;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.Callback:
                if (callback == null)
                {
                    return;
                }
                start = startValue;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 1000;
                }
                this.callback = callback;
                break;

            default:
                return;
            }

            Next();
            //Reversed();
        }
예제 #3
0
        public Animation(AnimationTypes type, object target, int offset, AnimationFinishedHandler handler, int duration, AnimationCallback callback, int startValue)
        {
            this.type = type;
            this.target = target;
            this.offset = offset;
            this.handler = handler;
            this.duration = duration;

            // timings in ms
            interval = 10;
            timePassed = 0;

            Control c;
            Form f;
            switch (type)
            {
                case AnimationTypes.ResizeHoriz:
                    c = target as Control;
                    if (c == null) return;
                    start = c.Width;
                    end = start + offset;
                    if (this.duration == 0) this.duration = 150;
                    break;
                case AnimationTypes.ResizeVert:
                    c = target as Control;
                    if (c == null) return;
                    start = c.Height;
                    end = start + offset;
                    if (this.duration == 0) this.duration = 150;
                    break;
                case AnimationTypes.FadeIn:
                    f = target as Form;
                    if (f == null) return;
                    start = (int)(f.Opacity * 100);
                    end = start + offset;
                    if (this.duration == 0) this.duration = 250;
                    break;
                case AnimationTypes.FadeOut:
                    f = target as Form;
                    if (f == null) return;
                    start = (int)(f.Opacity * 100);
                    end = start + offset;
                    if (this.duration == 0) this.duration = 2000;
                    break;
                case AnimationTypes.Callback:
                    if (callback == null) return;
                    start = startValue;
                    end = start + offset;
                    if (this.duration == 0) this.duration = 1000;
                    this.callback = callback;
                    break;
                default:
                    return;
            }

            Next();
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Animation"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="target">The target.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="duration">The duration.</param>
 public LocationAnimation(AnimationTypes type, object target, float offset, float mover, AnimationFinishedHandler handler, int duration)
     : this(type, target, offset, mover, handler, 0, null, 0, 10, 0, 0, 0)
 {
 }
예제 #5
0
 public Animation(AnimationTypes type, object target, int offset, AnimationFinishedHandler handler, int duration)
     : this(type, target, offset, handler, 0, null, 0)
 {
 }
예제 #6
0
        public Animation(AnimationTypes type, object target, int offset, AnimationFinishedHandler handler, int duration, AnimationCallback callback, int startValue)
        {
            this.type     = type;
            this.target   = target;
            this.offset   = offset;
            this.handler  = handler;
            this.duration = duration;

            // timings in ms
            interval   = 10;
            timePassed = 0;

            Control c;
            Form    f;

            switch (type)
            {
            case AnimationTypes.ResizeHoriz:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Width;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.ResizeVert:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Height;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.FadeIn:
                f = target as Form;
                if (f == null)
                {
                    return;
                }
                start = (int)(f.Opacity * 100);
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 250;
                }
                break;

            case AnimationTypes.FadeOut:
                f = target as Form;
                if (f == null)
                {
                    return;
                }
                start = (int)(f.Opacity * 100);
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 2000;
                }
                break;

            case AnimationTypes.Callback:
                if (callback == null)
                {
                    return;
                }
                start = startValue;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 1000;
                }
                this.callback = callback;
                break;

            default:
                return;
            }

            Next();
        }
예제 #7
0
 public Animation(AnimationTypes type, object target, int offset, AnimationFinishedHandler handler, int duration)
     : this(type, target, offset, handler, 0, null, 0)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Animation"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="target">The target.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="duration">The duration.</param>
        /// <param name="callback">The callback.</param>
        /// <param name="startValue">The start value.</param>
        /// <param name="timerInterval">The timer interval.</param>
        /// <param name="timePassed">The time passed.</param>
        /// <param name="reversed_duration">Duration of the reversed.</param>
        /// <param name="reversed_timePassed">The reversed time passed.</param>
        public Animation(AnimationTypes type, object target, float offset, AnimationFinishedHandler handler, int duration, AnimationCallback callback, int startValue, int timerInterval, int timePassed, int reversed_duration, int reversed_timePassed)
        {
            this.type              = type;
            this.target            = target;
            this.offset            = offset;
            this.handler           = handler;
            this.duration          = duration;
            this.reversed_duration = reversed_duration;

            // timings in ms
            this.interval            = timerInterval;
            this.timePassed          = timePassed;
            this.reversed_timePassed = reversed_timePassed;

            Control c;

            System.Windows.Forms.Form f;

            switch (type)
            {
            case AnimationTypes.ResizeHoriz:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Width;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }

                break;

            case AnimationTypes.ResizeVert:
                c = target as Control;
                if (c == null)
                {
                    return;
                }
                start = c.Height;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 150;
                }
                break;

            case AnimationTypes.FadeIn:
                f = target as System.Windows.Forms.Form;
                if (f == null)
                {
                    return;
                }
                start = (float)(f.Opacity * 100);
                //end = start + (float)offset/100;
                //if (this.duration == 0) this.duration = 250;
                break;

            case AnimationTypes.FadeOut:
                f = target as System.Windows.Forms.Form;
                if (f == null)
                {
                    return;
                }
                start = (float)(f.Opacity * 100);
                //end = start + (float)offset/100;
                //if (this.duration == 0) this.duration = 2000;
                break;

            case AnimationTypes.Callback:
                if (callback == null)
                {
                    return;
                }
                start = startValue;
                end   = start + offset;
                if (this.duration == 0)
                {
                    this.duration = 1000;
                }
                this.callback = callback;
                break;

            default:
                return;
            }

            Next();
            //Reversed();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Animation"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="target">The target.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="handler">The handler.</param>
 public Animation(AnimationTypes type, object target, float offset, AnimationFinishedHandler handler)
     : this(type, target, offset, handler, 0, null, 0, 10, 0, 0, 0)
 {
 }