示例#1
0
        protected override void configureTween()
        {
            if (this.tween == null)
            {
                if (this.target == null || string.IsNullOrEmpty(componentType) || string.IsNullOrEmpty(memberName))
                {
                    return;
                }

                this.component = target.GetComponent(this.componentType);
                if (component == null)
                {
                    return;
                }

                this.easingFunc = TweenEasingFunctions.GetFunction(this.easingType);

                this.tween = (Tween <T>)
                             component.TweenProperty <T>(memberName)
                             .SetEasing(this.modifyEasing)
                             .OnStarted((x) => { onStarted(); })
                             .OnStopped((x) => { onStopped(); })
                             .OnPaused((x) => { onPaused(); })
                             .OnResumed((x) => { onResumed(); })
                             .OnLoopCompleted((x) => { onLoopCompleted(); })
                             .OnCompleted((x) => { onCompleted(); });
            }

            var currentValue = TweenNamedProperty <T> .GetCurrentValue(component, memberName);

            var interpolator = DaikonForge.Tween.Interpolation.Interpolators.Get <T>();

            var actualStartValue = this.startValue;

            if (this.startValueType == TweenStartValueType.SyncOnRun)
            {
                actualStartValue = currentValue;
            }

            var actualEndValue = this.endValue;

            if (this.endValueType == TweenEndValueType.SyncOnRun)
            {
                actualEndValue = currentValue;
            }
            else if (this.endValueType == TweenEndValueType.Relative)
            {
                actualEndValue = interpolator.Add(actualEndValue, actualStartValue);
            }

            this.tween
            .SetStartValue(actualStartValue)
            .SetEndValue(actualEndValue)
            .SetDelay(this.startDelay, this.assignStartValueBeforeDelay)
            .SetDuration(this.duration)
            .SetLoopType(this.LoopType)
            .SetLoopCount(this.loopCount)
            .SetPlayDirection(this.playDirection);
        }
示例#2
0
 /// <summary>
 /// Returns a Tween&lt;T&gt; instance that is configured to animate the named property
 /// </summary>
 public static Tween <T> TweenProperty <T>(this object target, string propertyName, Interpolator <T> interpolator)
 {
     return(TweenNamedProperty <T> .Obtain(target, propertyName, interpolator));
 }
示例#3
0
 /// <summary>
 /// Returns a Tween&lt;T&gt; instance that is configured to animate the named property
 /// </summary>
 public static Tween <T> TweenProperty <T>(this object target, string propertyName)
 {
     return(TweenNamedProperty <T> .Obtain(target, propertyName));
 }