Beispiel #1
0
 private void EasingChanged(IEasing v)
 {
     if (duration_ != null)
     {
         duration_.Easing = v;
     }
 }
Beispiel #2
0
 public QuaternionEasingAnimator(IEasing easing, Quaternion start, Quaternion end, Func <float, float> duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration.Invoke(Quaternion.Angle(start, end));
 }
Beispiel #3
0
 public ColorEasingAnimator(IEasing easing, Color start, Color end, Func <float, float> duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration.Invoke(Vector4.Distance(start, end));
 }
Beispiel #4
0
 public Vector1EasingAnimator(IEasing easing, float start, float end, Func <float, float> duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration.Invoke(Mathf.Abs(start - end));
 }
Beispiel #5
0
 public Vector3EasingAnimator(IEasing easing, Vector3 start, Vector3 end, Func <float, float> duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration.Invoke(Vector3.Distance(start, end));
 }
 public ColorEasingAnimator(IEasing easing, Color start, Color end, float duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration;
 }
 public QuaternionEasingAnimator(IEasing easing, Quaternion start, Quaternion end, float duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration;
 }
 public Vector1EasingAnimator(IEasing easing, float start, float end, float duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.end      = end;
     this.duration = duration;
 }
Beispiel #9
0
 private void EasingChanged(IEasing e)
 {
     if (m_ != null && e != null)
     {
         m_.Easing = e;
     }
 }
Beispiel #10
0
 public Vector3EasingAnimatorMid(IEasing easing, Vector3 start, Vector3 mid, Vector3 end, float duration)
 {
     this.easing   = easing;
     this.start    = start;
     this.mid      = mid;
     this.end      = end;
     this.duration = duration;
 }
Beispiel #11
0
 public CameraMovement(Vector2 to, float duration, IEasing formula1, IEasing formula2)
 {
     this.From     = Camera.Instance.Location;
     this.To       = to;
     this.Duration = duration;
     this.EasingX  = formula1;
     this.EasingY  = formula2;
 }
Beispiel #12
0
 /// <summary>
 /// Create a translation displacement
 /// </summary>
 /// <param name="displacement">The displacement vector</param>
 /// <param name="duration">The duration of this movement</param>
 /// <param name="function1">The easing function to be used for the X axis</param>
 /// <param name="function2">The easing function to be used for the Y axis</param>
 public void Move(Vector2 displacement, float duration, IEasing function1, IEasing function2)
 {
     if (displacement == Vector2.Zero)
     {
         return;
     }
     this.CurrentMovement = new CameraMovement(displacement, duration, function1, function2);
 }
Beispiel #13
0
 public LineChartAnimatorViewModel()
 {
     _animationEasing    = Easing.Parse("0.4,0,0.6,1");
     _animationSpeed     = 0.05;
     _isAnimationRunning = false;
     _yValues            = new ObservableCollection <double>();
     _xValues            = new ObservableCollection <double>();
 }
Beispiel #14
0
 public Tween(float start, float target, TimeSpan targetRunTime, IEasing easing)
 {
     this.start = this.Value = start;
     this.target = target;
     this.targetRunTime = targetRunTime;
     this.easing = easing;
     this.elapsedTime = TimeSpan.Zero;
 }
Beispiel #15
0
 public IAnimate <TSource> SetEasingType(IEasing easing)
 {
     if (mCurrentAnim == null)
     {
         throw new NullReferenceException("Cannot set Duration, do you call Begin() before SetDelay() ?");
     }
     mCurrentAnim.EasingMethod = easing ?? throw new ArgumentNullException("easing param can't be null");
     return(this);
 }
Beispiel #16
0
 public override void Dispose()
 {
     base.Dispose();
     if (this._updater != null)
     {
         this._updater.Release();
     }
     this._easing  = null;
     this._updater = null;
 }
Beispiel #17
0
    public override void DoPlay()
    {
        _easing = EasingCore.Instance.GetEasing(_easingType);

        _value = _from;

        _timer.Wait(_duration);

        _state = State.Playing;
    }
    public override void DoPlay()
    {
        _easing = EasingCore.Instance.GetEasing(_easingType);

        _value = _from;

        _timer.Wait(_duration);

        _state = State.Playing;
    }
Beispiel #19
0
 public void Insert(float normalizedProgressKey, T value, IEasing easingFunction)
 {
     Validate(normalizedProgressKey);
     Add(new KeyFrame <T>
     {
         NormalizedProgressKey = normalizedProgressKey,
         Value          = value,
         EasingFunction = easingFunction
     });
 }
Beispiel #20
0
    /*===================================== Transform ========================================*/
    public static IAni To(GameObject target, XHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
    {
        ObjectTween tween = new ObjectTween(realTime ? (ITimer)_tickerReal : _ticker);

        tween.FrameSkip       = frameSkip;
        tween.updater         = _updaterFactory.Create(target, hash, hash.GetStart());
        tween.ClassicHandlers = hash;
        tween.time            = time;
        tween.easing          = (easing != null) ? easing : Linear.easeNone;
        return(tween);
    }
Beispiel #21
0
    /*===================================== Transform ========================================*/
    //Transform
    public static IXTween To(GameObject target, XHash hash, float time, IEasing easing = null, bool realTime = false)
    {
        ObjectTween tween = Pool <ObjectTween> .Pop();

        tween.Initialize(realTime ? (ITimer)_tickerReal : _ticker, 0);
        tween.Updater         = UpdaterFactory.Create(target, hash, hash.GetStart());
        tween.ClassicHandlers = hash;
        tween.Time            = time;
        tween.Easing          = (easing != null) ? easing : Linear.easeNone;
        return(tween);
    }
Beispiel #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Doog.AnimationBase`2"/> class.
        /// </summary>
        /// <param name="owner">The animation owner.</param>
        /// <param name="duration">The animation duration.</param>
        protected AnimationBase(TComponent owner, float duration)
            : base(owner.Context)
        {
            Owner = owner;

            this.Duration = duration;
            easing        = Doog.Easing.Linear;
            owner.AddChild(this);
            State     = AnimationState.NotPlayed;
            Direction = AnimationDirection.Any;
        }
Beispiel #23
0
    //Proerpty Type Only
    public static IAni To <T>(T target, XObjectHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
    {
        ObjectTween       tween   = new ObjectTween(realTime ? (ITimer)_tickerReal : _ticker);
        ObjectUpdater <T> updater = (ObjectUpdater <T>)UpdaterFactory.Create <T>(target, hash);

        tween.FrameSkip       = frameSkip;
        tween.updater         = updater;
        tween.ClassicHandlers = hash;
        tween.time            = time;
        tween.easing          = (easing != null) ? easing : Linear.easeNone;
        return(tween);
    }
Beispiel #24
0
        /// <summary>
        /// Animates a <see cref="PerspexProperty"/>.
        /// </summary>
        /// <typeparam name="T">The property type.</typeparam>
        /// <param name="target">The target object.</param>
        /// <param name="property">The target property.</param>
        /// <param name="start">The value of the property at the start of the animation.</param>
        /// <param name="finish">The value of the property at the end of the animation.</param>
        /// <param name="easing">The easing function to use.</param>
        /// <param name="duration">The duration of the animation.</param>
        /// <returns>An <see cref="Animation"/> that can be used to track or stop the animation.</returns>
        public static Animation <T> Property <T>(
            IObservablePropertyBag target,
            PerspexProperty <T> property,
            T start,
            T finish,
            IEasing <T> easing,
            TimeSpan duration)
        {
            var o = GetTimer(duration).Select(progress => easing.Ease(progress, start, finish));

            return(new Animation <T>(o, target.Bind(property, o, BindingPriority.Animation)));
        }
Beispiel #25
0
        /// <summary>
        /// Animates a <see cref="PerspexProperty"/>.
        /// </summary>
        /// <typeparam name="T">The property type.</typeparam>
        /// <param name="target">The target object.</param>
        /// <param name="property">The target property.</param>
        /// <param name="start">The value of the property at the start of the animation.</param>
        /// <param name="finish">The value of the property at the end of the animation.</param>
        /// <param name="easing">The easing function to use.</param>
        /// <param name="duration">The duration of the animation.</param>
        /// <returns>An <see cref="IDisposable"/> that can be used to stop the animation.</returns>
        public static IDisposable Property(
            PerspexObject target,
            PerspexProperty property,
            object start,
            object finish,
            IEasing easing,
            TimeSpan duration)
        {
            var o = GetTimer(duration).Select(progress => easing.Ease(progress, start, finish));

            return(target.Bind(property, o, BindingPriority.Animation));
        }
Beispiel #26
0
        /// <summary>
        /// Animates a <see cref="AvaloniaProperty"/>.
        /// </summary>
        /// <typeparam name="T">The property type.</typeparam>
        /// <param name="target">The target object.</param>
        /// <param name="property">The target property.</param>
        /// <param name="start">The value of the property at the start of the animation.</param>
        /// <param name="finish">The value of the property at the end of the animation.</param>
        /// <param name="easing">The easing function to use.</param>
        /// <param name="duration">The duration of the animation.</param>
        /// <returns>An <see cref="Animation"/> that can be used to track or stop the animation.</returns>
        public static Animation <T> Property <T>(
            IAvaloniaObject target,
            AvaloniaProperty <T> property,
            T start,
            T finish,
            IEasing <T> easing,
            TimeSpan duration)
        {
            var o = GetTimer(duration).Select(progress => easing.Ease(progress, start, finish));

            return(new Animation <T>(o, target.Bind(property, o, BindingPriority.Animation)));
        }
Beispiel #27
0
    /************************************************************************
    *	                Coroutine Declaration	                            *
    ************************************************************************/
    protected override IEnumerator CoroutineStart()
    {
        WaitForSeconds wait = new WaitForSeconds(0.1f);

        if (this._tween != null)
        {
            // this._tween.Stop();
            // this._tween = null;
        }

        if (this.target3D != null)
        {
            this.target2D.transform.localPosition = this._position2D;
            // this.target3D.transform.localPosition = this._position3D;
        }
        yield return(new WaitForSeconds(0.5f));

        TweenUIData data = this.uiContainer.Data;

        if (this.container2D.activeSelf)
        {
            this._tween = XTween.To(this.target2D, XHash.New.AddX(800f).AddY(300f), data.time, data.Easing);
            this._tween.Play();
        }
        else
        {
            IEasing ease = Ease.ElasticOut;
            yield return(wait);

            if (this._tween == null)
            {
                this._tween = target3D.ToPosition3D(200, 50, -1500, 3f).SetLock().SetReverse().SetRepeat(2).SetScale(2f).SetDelay(0.5f, 1f);
                this._tween.AddOnStop(() => Debug.Log("Stop"));
                this.isPlay = true;
                yield return(this._tween.WaitForPlay());
            }
            else
            {
                if (isPlay)
                {
                    isPlay = false;
                    this._tween.Stop();
                }
                else
                {
                    isPlay = true;
                    yield return(this._tween.WaitForPlay());
                }
            }
            this.StartXTween(this.target3D);
        }
    }
Beispiel #28
0
        static Easing()
        {
            All = new IEasing[]
            {
                Linear,

                InQuad,
                OutQuad,
                InOutQuad,

                InCubic,
                OutCubic,
                InOutCubic,

                InQuart,
                OutQuart,
                InOutQuart,

                InQuint,
                OutQuint,
                InOutQuint,

                InElastic,
                OutElastic,
                InOutElastic,

                InSin,
                OutSin,
                InOutSin,

                InExpo,
                OutExpo,
                InOutExpo,

                InCirc,
                OutCirc,
                InOutCirc,

                InBack,
                OutBack, // Steakhouse :D
                InOutBack,

                InBounce,
                OutBounce,
                InOutBounce
            };
        }
Beispiel #29
0
        public void Update()
        {
            if (this.lastTick == Find.TickManager.TicksGame)
            {
                return;
            }
            this.lastTick = Find.TickManager.TicksGame;
            if (this.Glows)
            {
                if (!pulse)
                {
                    this.glowColor  = Color32.Lerp(minGlowColor.ToColor32, maxGlowColor.ToColor32, 0.5f).AsColorInt();
                    this.glowRadius = Mathf.Lerp(minGlowRadius, maxGlowRadius, 0.5f);
                    return;
                }
                if (this.easing == null)
                {
                    if (this.easingType != null)
                    {
                        this.easing = (IEasing)Activator.CreateInstance(this.easingType);
                    }
                    else
                    {
                        this.easing = new EasingLinear();
                    }
                }
                var time = ((Find.TickManager.TicksGame + lag) % (this.intervalTicks * 2)) / this.intervalTicks;
                if (time > 1.0f)
                {
                    time = 2.0f - time;
                }
                var factor = this.easing.GetValue(time);

                this.glowColor  = Color32.Lerp(minGlowColor.ToColor32, maxGlowColor.ToColor32, factor).AsColorInt();
                this.glowRadius = Mathf.Lerp(minGlowRadius, maxGlowRadius, factor);
            }
            else
            {
                this.glowColor  = ((Color32)Color.clear).AsColorInt();
                this.glowRadius = 0;
            }
        }
Beispiel #30
0
 public Tween(IEasing easing, TweenType easingType = TweenType.In)
 {
     _name = easing.Name;
     _type = easingType;
     switch (easingType)
     {
             case TweenType.In:
             _easing = easing.In;
             break;
             case TweenType.Out:
             _easing = easing.Out;
             break;
             case TweenType.OutIn:
             _easing = easing.OutIn;
             break;
         default:
             throw new ArgumentException("easingType must be one of [Tween.TweenType.In, Tween.TweenType.Out, Tween.TweenType.OutIn]. Value: " + easingType);
     }
     StartTime = 0;
     EndTime = 1000;
     StartValue = 0;
     EndValue = 1;
 }
 public EasingVelocityAnimator(Velocity velocity, IEasing easing)
 {
     this.velocity = (float)velocity.PerSecond;
     this.easing   = easing;
 }
 public EasingDurationAnimator(TimeSpan duration, IEasing easing)
 {
     this.duration = (float)duration.TotalSeconds;
     this.easing   = easing;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyTransition"/> class.
 /// </summary>
 /// <param name="property">The property to be animated/</param>
 /// <param name="duration">The duration of the animation.</param>
 /// <param name="easing">The easing function to use.</param>
 public PropertyTransition(AvaloniaProperty property, TimeSpan duration, IEasing easing)
 {
     Property = property;
     Duration = duration;
     Easing = easing;
 }
        public static List <PolyLine> ToCache(PolyLine source, PolyLine target, double speed, IEasing easing, bool interpolateXAxis = true)
        {
            int    steps = (int)(1 / speed);
            double p     = speed;
            var    cache = new List <PolyLine>(steps);

            for (int i = 0; i < steps; i++)
            {
                var clone = source.Clone();
                var easeP = easing.Ease(p);

                To(clone, target, easeP, interpolateXAxis);

                p += speed;

                cache.Add(clone);
            }

            return(cache);
        }
Beispiel #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyTransition"/> class.
 /// </summary>
 /// <param name="property">The property to be animated/</param>
 /// <param name="duration">The duration of the animation.</param>
 /// <param name="easing">The easing function to use.</param>
 public PropertyTransition(PerspexProperty property, TimeSpan duration, IEasing easing)
 {
     Property = property;
     Duration = duration;
     Easing = easing;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyTransition"/> class.
 /// </summary>
 /// <param name="property">The property to be animated/</param>
 /// <param name="duration">The duration of the animation.</param>
 /// <param name="easing">The easing function to use.</param>
 public PropertyTransition(PerspexProperty property, TimeSpan duration, IEasing easing)
 {
     this.Property = property;
     this.Duration = duration;
     this.Easing = easing;
 }