예제 #1
0
 public static TweenManager managed(
     this TweenTimelineElement timeline, TweenManager.Loop looping, TweenTime time = TweenTime.OnUpdate,
     float delay = 0,
     [CallerMemberName] string callerMemberName = "",
     [CallerFilePath] string callerFilePath     = "",
     [CallerLineNumber] int callerLineNumber    = 0
     ) => new TweenManager(
     TweenTimeline.single(timeline, delay), time, looping,
     createContext(callerMemberName, callerFilePath, callerLineNumber)
     );
예제 #2
0
        public void Start()
        {
//      var obj3T = TweenOps.vector3.tween(
//        obj3.position, obj3.position + Vector3.right * 10, Eases.linear, duration
//      );
//      var obj23T = obj2T
//      var obj4T = TweenOps.vector3.tween(
//        obj4.position, obj4.position + Vector3.right * 10, Eases.quadratic, duration
//      );
//      var obj4T2 = TweenOps.vector3.tween(
//        obj4T.end, obj4T.end + Vector3.right * 10, Eases.quadratic, duration
//      );
//
//      //
//
            var t1     = obj1.tweenPositionRelative(Vector3.right * 5, Eases.linear, duration);
            var t2     = obj1.tweenPositionRelative(Vector3.up, Eases.expoOut, duration);
            var t3     = obj1.tweenPositionRelative(Vector3.down, Eases.quadInOut, duration);
            var t4     = obj1.tweenPositionRelative(Vector3.left, Eases.elasticInOut, duration);
            var tweens = new TweenTimelineElement[] { t1 /*, t2, t3, t4*/ };

            var tra = TweenTimeline.parallelEnumerable(tweens /*.shuffleRepeatedly(Rng.now).Take(100)*/).build();

//        Tween.callback(_ => print($"start {_}")),
//        Tween.callback(_ => print($"1 {_}")),
//        obj2.tweenPositionRelative(Vector3.right * 2, Eases.linear, duration),
//        obj2.tweenPositionRelative(Vector3.right * 2, Eases.linear, 0f),
//        Tween.callback(_ => print($"2 {_}")),
//        t1.tweenPositionRelative(Vector3.right * 2, Eases.linear, duration),
//        Tween.callback(_ => print($"end {_}"))
            manager = tra.managed();
            var tr = TweenTimeline.sequential(
                /*tra, tra.reversed(), tra.reversed().reversed(), *//*tra.reversed()*/
                ).build();
//      manager = tr.managed()
//        .onStart(forwards => indicator.color = forwards ? Color.black : Color.green)
//        .onEnd(forwards => indicator.color = forwards ? Color.gray : Color.red);

//      var tr1 =
//        TweenSequence.Builder.create()
//          .append(obj1.tweenPositionRelative(Vector3.right * 10, Eases.cubic, duration))
//          .append(obj2.tweenPositionRelative(Vector3.right * 10, Eases.sin, duration))
//          .build();
//
//      tr =
//        TweenSequence.Builder.create()
//          .append(tr1)
//          .insert(1, obj3.tweenPositionRelative(Vector3.right * 10, Eases.linear, duration))
//          .append(obj4.tweenPositionRelative(Vector3.right * 10, Eases.cubic, duration))
//          .append(obj4.tweenPosition(Vector3.left * 10, Eases.quadratic, duration))
//          .build();
//
//      ASync.WithDelay(tr.totalDuration, tr.reset);
//      ASync.WithDelay(tr.totalDuration * 2, tr.reset);
        }
예제 #3
0
 public static TweenManager managed(
     this TweenTimelineElement timeline, TweenManager.Loop looping, TweenTime time = TweenTime.OnUpdate,
     float delay = 0
     ) => new TweenManager(TweenTimeline.single(timeline, delay), time, looping);
예제 #4
0
        public void Start()
        {
            List <Vector3> positionArray = new List <Vector3>();

            positionArray.Add(new Vector3(0f, 0f, 0f));
            positionArray.Add(new Vector3(0f, 5f, 5f));
            positionArray.Add(new Vector3(6f, 5f, 5f));
            positionArray.Add(new Vector3(12f, 0f, 5f));
            positionArray.Add(new Vector3(12f, 0f, 0f));
            //      positionArray.Add(new Vector3(12f, 0f, 0f));

            //FunPath path = new FunPath(positionArray);
            // FunPath path2 = new FunPath(path.convertList(lines[0].pathVerts));


            // print("path lenght test: " + path.length());
            //print("path nodes test: " + path.nodes);
            //  print("path point test: " + path.evaluate(0.8f));
            //      var obj3T = TweenOps.vector3.tween(
            //        obj3.position, obj3.position + Vector3.right * 10, Eases.linear, duration
            //      );
            //      var obj23T = obj2T
            //      var obj4T = TweenOps.vector3.tween(
            //        obj4.position, obj4.position + Vector3.right * 10, Eases.quadratic, duration
            //      );
            //      var obj4T2 = TweenOps.vector3.tween(
            //        obj4T.end, obj4T.end + Vector3.right * 10, Eases.quadratic, duration
            //      );
            //
            //      //
            //
            // var t1 = obj1.tweenTransformByPath(0f, 1f, path, Eases.quadInOut, duration);
            var t2 = obj2.tweenPositionRelative(Vector3.up, Eases.expoOut, duration);
            var t3 = obj1.tweenPositionRelative(Vector3.down, Eases.quadInOut, duration);
            var t4 = obj1.tweenPositionRelative(Vector3.left, Eases.elasticInOut, duration);
            //   var tweens = new TweenTimelineElement[] {t1, t2 /*, t3, t4*/};

            // var tra = TweenTimeline.parallelEnumerable(tweens /*.shuffleRepeatedly(Rng.now).Take(100)*/).build();
            //        Tween.callback(_ => print($"start {_}")),
            //        Tween.callback(_ => print($"1 {_}")),
            //        obj2.tweenPositionRelative(Vector3.right * 2, Eases.linear, duration),
            //        obj2.tweenPositionRelative(Vector3.right * 2, Eases.linear, 0f),
            //        Tween.callback(_ => print($"2 {_}")),
            //        t1.tweenPositionRelative(Vector3.right * 2, Eases.linear, duration),
            //        Tween.callback(_ => print($"end {_}"))
            // manager = tra.managed();
            var tr = TweenTimeline.sequential(
                /*tra, tra.reversed(), tra.reversed().reversed(), */ /*tra.reversed()*/
                ).build();
            //      manager = tr.managed()
            //        .onStart(forwards => indicator.color = forwards ? Color.black : Color.green)
            //        .onEnd(forwards => indicator.color = forwards ? Color.gray : Color.red);

            //      var tr1 =
            //        TweenSequence.Builder.create()
            //          .append(obj1.tweenPositionRelative(Vector3.right * 10, Eases.cubic, duration))
            //          .append(obj2.tweenPositionRelative(Vector3.right * 10, Eases.sin, duration))
            //          .build();
            //
            //      tr =
            //        TweenSequence.Builder.create()
            //          .append(tr1)
            //          .insert(1, obj3.tweenPositionRelative(Vector3.right * 10, Eases.linear, duration))
            //          .append(obj4.tweenPositionRelative(Vector3.right * 10, Eases.cubic, duration))
            //          .append(obj4.tweenPosition(Vector3.left * 10, Eases.quadratic, duration))
            //          .build();
            //
            //      ASync.WithDelay(tr.totalDuration, tr.reset);
            //      ASync.WithDelay(tr.totalDuration * 2, tr.reset);
        }