public MoveByOptions(Vector3 offset, float duration = 1)
 {
     this.offset               = offset;
     this.spaceType            = SpaceType.Local;
     this.customSpaceTransform = null;
     this.tweenOptions         = new TweenOptions(duration);
 }
        public override Tween CreateTween(TweenOptions data)
        {
            if (data.Target.GetComponent <Renderer>() == null)
            {
                return(null);
            }
            bool curveExist = (data.Ease == Ease.Custom) && data.Curve.length >= 2;

            var tween = new UnityTweenMaterialColor(data.Target.GetComponent <Renderer>(), data.Color.To, data.IsAdditive);

            if (data.Color.FromIsDifferentThanCurrent)
            {
                tween.SetFrom(data.Color.From);
            }

            tween.SetDelay(data.Delay).SetDuration(data.Duration);

            if (curveExist)
            {
                tween.SetForwardEase(data.Curve);
            }
            else
            {
                tween.SetForwardEase(data.Ease);
            }

            return(tween);
        }
示例#3
0
        public override Tween CreateTween(TweenOptions data)
        {
            if (data.Target.transform == null)
            {
                return(null);
            }
            bool curveExist = (data.Ease == Ease.Custom) && data.Curve.length >= 2;

            var tween = new UnityTweenPosition(data.Target.transform, data.Vector.To, data.IsAdditive);

            if (data.Vector.FromIsDifferentThanCurrent)
            {
                tween.SetFrom(data.Vector.From);
            }

            tween.SetDelay(data.Delay).SetDuration(data.Duration);

            if (curveExist)
            {
                tween.SetForwardEase(data.Curve);
            }
            else
            {
                tween.SetForwardEase(data.Ease);
            }

            return(tween);
        }
 public MoveToOptions(Vector3 position, float duration = 1)
 {
     this.position             = position;
     this.spaceType            = SpaceType.Local;
     this.customSpaceTransform = null;
     this.tweenOptions         = new TweenOptions(duration);
 }
示例#5
0
        public static TweenActionDriver <TState> Prepare(TState state, TweenOptions options)
        {
            TweenActionDriver <TState> driver = _pool.Request();

            driver.Prepare(state, options, _tokenAllocator.Next());
            Trace.TraceAllocation(driver);
            return(driver);
        }
示例#6
0
 public void Initialize(TweenOptions o)
 {
     duration    = o.duration;
     EndEvent    = o.EndEvent;
     StartVector = o.StartVector;
     EndVector   = o.EndVector;
     curve       = o.curve;
     tweenType   = o.tweenType;
     timer       = 0;
 }
示例#7
0
 private void Prepare(TState userState, TweenOptions options, short token)
 {
     if (status != TweenStatus.NotPrepared)
     {
         throw new System.InvalidOperationException("Status error:" + this.status);
     }
     _tweenOptions       = options;
     _actionState        = new ActionState(options.duration, options.ease);
     _userState          = userState;
     _paused             = false;
     _token              = token;
     _actionState.status = TweenStatus.Prepared;
     this.autoRelease    = true;
     this.RegisterTick();
 }
        public override Tween CreateTween(TweenOptions data)
        {
            if (data.Target.GetComponent<RectTransform>() == null) return null;
            bool curveExist = (data.Ease == Ease.Custom) && data.Curve.length >= 2;

            var tween = new UnityTweenAnchoredPosition(data.Target.GetComponent<RectTransform>(), data.Vector.To, data.IsAdditive);
            if (data.Vector.FromIsDifferentThanCurrent)
                tween.SetFrom(data.Vector.From);

            tween.SetDelay(data.Delay).SetDuration(data.Duration);

            if (curveExist) tween.SetForwardEase(data.Curve);
            else tween.SetForwardEase(data.Ease);

            return tween;
        }
示例#9
0
        private static TweenOperation CompositeInternal(List <TweenOperation> operations)
        {
            var duration = 0f;

            for (var i = 0; i < operations.Count; i++)
            {
                var op = operations[i];
                duration       = Mathf.Max(duration, op.duration);
                op.paused      = true;
                op.autoRelease = false;
            }
            var state = new State()
            {
                operations = operations
            };
            var tweenOptions = new TweenOptions(duration);

            return(TweenAction <State> .Prepare(state, tweenOptions));
        }
示例#10
0
        /// <summary>
        /// operations必须是从pool中取的
        /// </summary>
        private static TweenOperation CompositeInternal(List <TweenOperation> operations)
        {
            var duration = 0f;

            for (var i = 0; i < operations.Count; i++)
            {
                var op = operations[i];
                duration      += op.duration;
                op.paused      = true;
                op.autoRelease = false;
            }
            if (duration < 0)
            {
                throw new System.InvalidOperationException("duration of tweens out of bounds");
            }
            var state = new State()
            {
                operations = operations,
            };
            var tweenOptions = new TweenOptions(duration);

            return(TweenAction <State> .Prepare(state, tweenOptions));
        }
示例#11
0
 public static Tween CreateTween(AnimationType type, TweenOptions data)
 {
     return(_tweens[type].CreateTween(data));
 }
示例#12
0
 public TintToOptions(Color color, TweenOptions tweenOptions)
 {
     this.color        = color;
     this.tweenOptions = tweenOptions;
 }
示例#13
0
 public TintToOptions(Color color, float duration = 1)
 {
     this.color        = color;
     this.tweenOptions = new TweenOptions(duration);
 }
示例#14
0
 public AlphaToOptions(float alpha, float duration = 1)
 {
     this.alpha   = alpha;
     tweenOptions = new TweenOptions(duration);
 }
示例#15
0
 public void Initialize(AttackBehaviourDefinition def)
 {
     forwardTweeningOptions  = def.ForwardTweeningOptions;
     backwardTweeningOptions = def.BackwardTweeningOptions;
 }
 public ScaleToOptions(Vector3 scale, float duration = 1)
 {
     this.scale        = scale;
     this.tweenOptions = new TweenOptions(duration);
 }
示例#17
0
 public TweenOperation Action <TContext>(InterpolationUpdate <TValue, TContext> onUpdate, TContext context, TweenOptions options)
 {
     return(UpdateController <TContext> .Prepare(from, to, onUpdate, context, options));
 }
示例#18
0
 public TweenOperation Property(object target, IPropertyAccesser <TValue> property, TweenOptions options)
 {
     return(PropertyController.Prepare(target, property, delta, options));
 }
示例#19
0
        public static TweenOperation Prepare(TState state, TweenOptions options)
        {
            var driver = TweenActionDriver <TState> .Prepare(state, options);

            return(new TweenOperation(driver));
        }
 public RotateToOptions(Vector3 eulerAngles, EaseFunction ease, float duration = 1)
 {
     this.eulerAngles  = eulerAngles;
     this.tweenOptions = new TweenOptions(duration, ease);
 }
 public RotateToOptions(Vector3 eulerAngles, float duration = 1)
 {
     this.eulerAngles  = eulerAngles;
     this.tweenOptions = new TweenOptions(duration);
 }
 public ScaleToOptions(Vector3 scale, EaseFunction ease, float duration = 1)
 {
     this.scale        = scale;
     this.tweenOptions = new TweenOptions(duration, ease);
 }
示例#23
0
            public static TweenOperation Prepare(TValue from, TValue to, InterpolationUpdate <TValue, TContext> onUpdate, TContext context, TweenOptions options)
            {
                var state = new State()
                {
                    from     = from,
                    to       = to,
                    onUpdate = onUpdate,
                    context  = context,
                };

                return(TweenAction <State> .Prepare(state, options));
            }
 public AnchoredPositionToOptions(Vector2 position, float duration)
 {
     this.position     = position;
     this.tweenOptions = new TweenOptions(duration);
 }
示例#25
0
 public static TweenOperation Prepare(TObject target,PropertyAccesser<TObject,TValue> property, TValue from,TweenOptions options){
     var state = new State(){
         from = from,
         target = target,
         property = property
     };
     return TweenAction<State>.Prepare(state,options);          
 }
示例#26
0
 public TweenOperation Property <TObject>(TObject target, IPropertyAccesser <TObject, TValue> property, TweenOptions options)
 {
     return(PropertyController.Prepare(target, property, _values, options));
 }
示例#27
0
 public abstract Tween CreateTween(TweenOptions data);
示例#28
0
            public static TweenOperation Prepare(object target, IPropertyAccesser <TValue> property, TValue delta, TweenOptions options)
            {
                var state = new State()
                {
                    delta    = delta,
                    target   = target,
                    property = property
                };

                return(TweenAction <State> .Prepare(state, options));
            }
示例#29
0
        public TweenOperation Property <TObject>(TObject target, PropertyAccesser <TObject, TValue> property, TweenOptions options)
        {
            var context = new TargetProperty <TObject, TValue>(target, property);

            return(this.Action(PropertyUpdateAction <TObject> .onUpdate, context, options));
        }