Ejemplo n.º 1
0
 public static TweenBuilder <SceneComponent> Rotate(this TweenBuilder <SceneComponent> tweenTarget, Quaternion quaternion)
 {
     return(Value(
                tweenTarget,
                quaternion,
                t => t.RelativeRotation,
                (t, v) => t.RelativeRotation = v));
 }
Ejemplo n.º 2
0
 public static TweenBuilder <SceneComponent> Translate(this TweenBuilder <SceneComponent> tweenTarget, Vector3 translation)
 {
     return(Value(
                tweenTarget,
                translation,
                t => t.RelativeTranslation,
                (t, v) => t.RelativeTranslation = new Vector3(v.X, v.Y, v.Z)));
 }
Ejemplo n.º 3
0
 public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, Vector3 scale)
 {
     return(Value(
                tweenTarget,
                scale,
                t => t.RelativeScale,
                (t, v) => t.RelativeScale = v));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Append a new chain element
        /// </summary>
        public TweenBuilder <TTarget> Then()
        {
            var newTarget = new TweenBuilder <TTarget>(Targets);

            newTarget.Root = Root;
            NextChain      = newTarget;
            newTarget.CurrentTween.Duration  = CurrentTween.Duration;
            newTarget.CurrentTween.ScaleFunc = CurrentTween.ScaleFunc;
            //newTarget.CurrentTween.Repeat = CurrentTween.Repeat;
            newTarget.CurrentTween.Order = CurrentTween.Order + 1;
            return(newTarget);
        }
Ejemplo n.º 5
0
 private TweenFinishedDelegate StartNextChain(TweenBuilder nextChain)
 {
     return(() =>
     {
         foreach (var tweenTarget in nextChain.TweenTargets)
         {
             foreach (var tween in tweenTarget.Tweens)
             {
                 tween.Start();
             }
         }
     });
 }
Ejemplo n.º 6
0
        public TweenBuilder <TNewTarget> For <TNewTarget>(TNewTarget target)
        {
            var newTarget = new TweenBuilder <TNewTarget>(target);

            newTarget.Root = Root;
            NextTarget     = newTarget;
            newTarget.CurrentTween.Duration  = CurrentTween.Duration;
            newTarget.CurrentTween.ScaleFunc = CurrentTween.ScaleFunc;
            //newTarget.CurrentTween.Repeat = CurrentTween.Repeat;
            newTarget.CurrentTween.Order = CurrentTween.Order + 1;
            newTarget.ChainLevel         = ChainLevel + 1;
            return(newTarget);
        }
Ejemplo n.º 7
0
        public static TweenBuilder <TTarget> Value <TTarget, TValue>(TweenBuilder <TTarget> tweenTarget, TValue value, Func <TTarget, TValue> getValue, Action <TTarget, TValue> setValue)
        {
            var tween = tweenTarget.NewTween <Tween <TValue> >();

            Tuple <TTarget, TValue>[] targets = null;
            tween.OnStart = () =>
            {
                targets = tweenTarget.Targets.Select(t => new Tuple <TTarget, TValue>(t, getValue(t))).ToArray();
            };
            tween.Tick = () =>
            {
                foreach (var comp in targets)
                {
                    var v = tween.LerpFunc(comp.Item2, value, tween.ScaledPosition);
                    setValue(comp.Item1, v);
                }
            };
            return(tweenTarget);
        }
Ejemplo n.º 8
0
 public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, float x, float y, float z)
 {
     return(Scale(tweenTarget, new Vector3(x, y, z)));
 }
Ejemplo n.º 9
0
 public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, float scale)
 {
     return(Scale(tweenTarget, new Vector3(scale)));
 }
Ejemplo n.º 10
0
 public static TweenBuilder <SceneComponent> Translate(this TweenBuilder <SceneComponent> tweenTarget, float x, float y)
 {
     return(Translate(tweenTarget, new Vector2(x, y)));
 }