public Vector2Tweener( Vector2 start, Vector2 end, TimeSpan duration, TweeningFunction tweeningFunction ) { _tweenerX = new Tweener( start.X, end.X, duration, tweeningFunction ) ; _tweenerY = new Tweener( start.Y, end.Y, duration, tweeningFunction) ; _tweenerX.Ended += ( ) => { if( _tweenerY.HasEnded ) { if( Ended != null ) { Ended( ) ; } } }; _tweenerY.Ended += ( ) => { if( _tweenerX.HasEnded ) { if( Ended != null ) { Ended( ) ; } } }; }
public Vector2Tweener( Vector2 start, Vector2 end, TimeSpan duration, TweeningFunction tweeningFunction) { _tweenerX = new Tweener(start.X, end.X, duration, tweeningFunction); _tweenerY = new Tweener(start.Y, end.Y, duration, tweeningFunction); _tweenerX.Ended += () => { if (_tweenerY.HasEnded) { if (Ended != null) { Ended( ); } } }; _tweenerY.Ended += () => { if (_tweenerX.HasEnded) { if (Ended != null) { Ended( ); } } }; }
public Tweener(float from, float to, float duration, TweeningFunction tweeningFunction) { _from = from; _position = from; _change = to - from; _tweeningFunction = tweeningFunction; _duration = duration; }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> protected BaseTweener(T from, T to, float duration, TweeningFunction tweeningFunction) { _from = from; _position = from; _change = CalculateChange(to, from); _tweeningFunction = tweeningFunction; _duration = duration; }
/// <summary> /// Create a stopped tweener with no information on where to move from and to. /// Useful in conjunction with the Reset(from, to) call to ready a tweener for later use or lazy /// instantiation of a tweener in a property. /// </summary> /// <param name="duration">The duration of tweening.</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> protected BaseTweener(T from, T to, TweeningFunction tweeningFunction, float speed) { _from = from; _position = from; _change = CalculateChange(to, from); _tweeningFunction = tweeningFunction; _duration = CalculateDurationFromSpeed(speed); }
private TweenLite(float from, float to, float duration, TweeningFunction tweeningFunction, Action <float> onupdate) { _from = from; _position = from; _change = to - from; _tweeningFunction = tweeningFunction; _duration = duration; _onupdate = onupdate; }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> protected BaseTweener(string propertyName, T from, T to, float duration, TweeningFunction tweeningFunction) { PropertyName = propertyName; this.@from = from; _position = from; change = CalculateChange(to, from); this.tweeningFunction = tweeningFunction; _duration = duration; }
public TweenPositionTo(BaseEntity entity, Vector2 to, float duration, TweeningFunction tween) { this.entity = entity; this.to = to; this.duration = duration; this.tween = tween; isComplete = false; }
public TweenPositionToEntity(BaseEntity entity, BaseEntity to, Point offset, float duration, TweeningFunction tween) { this.entity = entity; this.to = to; this.offset = offset; this.duration = duration; this.tween = tween; isComplete = false; }
public Tweener(float from, float to, float duration, TweeningFunction tweeningFunction) { From = from; Position = from; Change = to - from; Function = tweeningFunction; Duration = duration; Elapsed = 0.0f; Running = true; }
public void Start(float from, float to, float duration, TweeningFunction tweeningFunction) { _from = from; _position = from; _change = to - from; _tweeningFunction = tweeningFunction; Duration = duration; _elapsed = 0; Running = true; }
public Tweener(float from, float to, float duration, TweeningFunction tweeningFunction) { _tweeningFunction = tweeningFunction; Running = true; _elapsed = 0.0f; _from = @from; _to = to; Position = @from; _change = to - @from; _duration = duration; }
public static TweenLite To(Vector2 from, Vector2 to, float duration, TweeningFunction tweeningFunction, Action <Vector2> onupdate, Action onend = null) { float _x = 0; var _xTween = TweenLite.To(from.x, to.x, duration, tweeningFunction, v => _x = v); var _yTween = TweenLite.To(from.y, to.y, duration, tweeningFunction, _y => onupdate?.Invoke(new Vector2(_x, _y)), onend); _yTween.BeforeRelease += () => { _xTween.Release(); }; return(_yTween); }
/// <summary> /// /// </summary> /// <param name="from">起始值</param> /// <param name="to">结束值</param> /// <param name="duration">缓动时间(单位:毫秒)</param> /// <param name="tweeningFunction">缓动方式</param> /// <param name="onupdate"> /// 每帧Update的回调 /// 参数 float 标示当前的插值 /// </param> /// <param name="onend">缓动结束时的回调</param> /// <returns></returns> public static TweenLite To(float from, float to, float duration, TweeningFunction tweeningFunction, Action <float> onupdate, Action onend = null) { lock (m_tasklock) { var tween = new TweenLite(from, to, duration, tweeningFunction, onupdate); if (onend != null) { tween.Ended += () => { onend(); } } ; m_tweeners.Add(tween); return(tween); } }
public Marquee(MarqueeText[] texts) { _timer = new(1000.Seconds()); _texts = texts; _index = -1; selectNext(); _tweeningFunction = Tweener.CreateTweeningFunction <Elastic>(Easing.EaseInOut); var colorTweeningFunction = Tweener.CreateTweeningFunction <Linear>(Easing.EaseNone); _colorTweener = new(.33f, 1, .33f.Seconds(), colorTweeningFunction); _colorTweener.Ended += () => { _colorTweener.Reverse(); _colorTweener.Reset(); }; }
public static TweenLite To(Color from, Color to, float duration, TweeningFunction tweeningFunction, Action <Color> onupdate, Action onend = null) { float r = 0; float g = 0; float b = 0; var _rTween = TweenLite.To(from.r, to.r, duration, tweeningFunction, v => r = v); var _gTween = TweenLite.To(from.g, to.g, duration, tweeningFunction, v => g = v); var _bTween = TweenLite.To(from.b, to.b, duration, tweeningFunction, v => b = v); var _aTween = TweenLite.To(from.a, to.a, duration, tweeningFunction, a => onupdate?.Invoke(new Color(r, g, b, a)), onend); _aTween.BeforeRelease += () => { _rTween.Release(); _gTween.Release(); _bTween.Release(); }; return(_aTween); }
public Tweener(float from, float to, float duration, TweeningFunction tweeningFunction) { Start(from, to, duration, tweeningFunction); // Start sets Running to true, so let's set it to false Running = false; }
/// <summary> /// Create a Tweener with info on where to move from and to, but set the duration using the movement /// speed instead of a set timespan. /// Note that the speed is used to calculate how fast the tweener should move if it moved in a linear /// fashion. This can be upset by the tweening function that can cause the actual movement speed to vary /// considerably. So the speed can be looked at as an average speed during the lifetime of the tweener. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">The average movement speed of the tweener</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public Tweener(float from, float to, TweeningFunction tweeningFunction, float speed) : base(from, to, tweeningFunction, speed) { }
private TweenLite(float from, float to, TimeSpan duration, TweeningFunction tweeningFunction, Action <float> onupdate) : this(from, to, (float)duration.TotalSeconds, tweeningFunction, onupdate) { }
/// <summary> /// Create a stopped tweener with no information on where to move from and to. /// Useful in conjunction with the Reset(from, to) call to ready a tweener for later use or lazy /// instantiation of a tweener in a property. /// </summary> /// <param name="duration">The duration of tweening.</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> protected BaseTweener(TweeningFunction tweeningFunction) { _tweeningFunction = tweeningFunction; _playing = false; }
public Tweener(float from, float to, TimeSpan duration, TweeningFunction tweeningFunction) : this(from, to, (float)duration.TotalSeconds, tweeningFunction) { }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public Vector3Tweener(Vector3 from, Vector3 to, TimeSpan duration, TweeningFunction tweeningFunction) : base(from, to, (float)duration.TotalSeconds, tweeningFunction) { }
/// <summary> /// Create a Tweener with info on where to move from and to, but set the duration using the movement /// speed instead of a set timespan. /// Note that the speed is used to calculate how fast the tweener should move if it moved in a linear /// fashion. This can be upset by the tweening function that can cause the actual movement speed to vary /// considerably. So the speed can be looked at as an average speed during the lifetime of the tweener. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">The average movement speed of the tweener</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public Vector3Tweener(Vector3 from, Vector3 to, TweeningFunction tweeningFunction, float speed) : base(from, to, tweeningFunction, speed) { }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public ColorTweener(Color from, Color to, float duration, TweeningFunction tweeningFunction) : base(from, to, duration, tweeningFunction) { }
public void start() { _startTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; _startTime += _delayTime; if (_tweenFunc == null) _tweenFunc = Tweener.GetFunction(TransitionType.LINEAR); if (_startVal == -1) _startVal = float.Parse(_prop.GetValue(_object, null).ToString()); }
/// <summary> /// Create a Tweener with info on where to move from and to, but set the duration using the movement /// speed instead of a set timespan. /// Note that the speed is used to calculate how fast the tweener should move if it moved in a linear /// fashion. This can be upset by the tweening function that can cause the actual movement speed to vary /// considerably. So the speed can be looked at as an average speed during the lifetime of the tweener. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">The average movement speed of the tweener</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public ColorTweener(Color from, Color to, TweeningFunction tweeningFunction, float speed) : base(from, to, tweeningFunction, speed) { }
/// <summary> /// Create a stopped tweener with no information on where to move from and to. /// Useful in conjunction with the Reset(from, to) call to ready a tweener for later use or lazy /// instantiation of a tweener in a property. /// </summary> /// <param name="duration">The duration of tweening.</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public ColorTweener(TweeningFunction tweeningFunction) : base(tweeningFunction) { }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public ColorTweener(Color from, Color to, TimeSpan duration, TweeningFunction tweeningFunction) : base(from, to, (float)duration.TotalSeconds, tweeningFunction) { }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public Vector3Tweener(Vector3 from, Vector3 to, float duration, TweeningFunction tweeningFunction) : base(from, to, duration, tweeningFunction) { }
protected CAAnimation(string propertyName, float from, float to, TimeSpan duration, TweeningFunction tweeningFunction) : base(propertyName, from, to, duration, tweeningFunction) { }
/// <summary> /// Create a stopped tweener with no information on where to move from and to. /// Useful in conjunction with the Reset(from, to) call to ready a tweener for later use or lazy /// instantiation of a tweener in a property. /// </summary> /// <param name="duration">The duration of tweening.</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> public Vector3Tweener(TweeningFunction tweeningFunction) : base(tweeningFunction) { }
protected CAAnimation(TweeningFunction tweeningFunction) : base(tweeningFunction) { }
public Tweener(float from, float to, float duration, TweeningFunction tweeningFunction) { this.tweeningFunction = tweeningFunction; Initialise(from, to, duration); }
protected CAAnimation(string propertyName, float from, float to, TweeningFunction tweeningFunction, float speed) : base(propertyName, from, to, tweeningFunction, speed) { }
public TweenData(object o, string property_name, float startVal, float endVal, int duration, TransitionType transitionType) { this._object = o; this._prop = _object.GetType().GetProperty(property_name); _startVal = startVal; _endVal = endVal == -1 ? float.Parse(_prop.GetValue(_object, null).ToString()) : endVal; _duration = duration; _property_name = property_name; _tweenFunc = Tweener.GetFunction(transitionType); }
/// <summary> /// Create a Tweener with info on where to move from and to, how long it should take and the function to use. /// </summary> /// <param name="from">The starting position</param> /// <param name="to">The position reached at the end</param> /// <param name="duration">How long befor we reach the end?</param> /// <param name="tweeningFunction">Which function to use for calculating the current position.</param> protected BaseTweener(T from, T to, TimeSpan duration, TweeningFunction tweeningFunction) : this(from, to, (float)duration.TotalSeconds, tweeningFunction) { }