phanductrieu / hotween

Automatically exported from code.google.com/p/hotween
0 stars 0 forks source link

Allow loops and delays inside Sequences #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a tween on anything and put a delay.
2. Put that tween into a sequence, and play the sequence : the delay is no more 
taken into account.

What is the expected output? What do you see instead?

I'm expecting delays to be kept and the tween to play exactly the same inside 
or outside a sequence. In a general way I'm expecting all behaviors of Tweener 
to work exactly the same when inside Sequence, the sequence being only a.. 
sequence of tween. Once one is ended, the following one is started.

What version of the product are you using? On what operating system?

Under Windows, using HOTween_1_1_882

Please provide any additional information below.

I have helper methods that create basics effects that incorporate delay as a 
parameter ( alpha fading, scale effects, etc. jelly, shake, bound, spin, etc. 
). I need to combine those small effects into sequences. I'm creating complex 
effects with smaller effect as bricks.

I'd like my code to looks like :

Sequence seq = ...
seq.Append ( animateAlpha ( ..., 1 ) );
seq.Append ( animateJelly ( ..., 2 ) );
seq.Append ( animateAlpha ( ..., 1 ) );

But for now it is :

Sequence seq = ...
seq.AppendInterval ( 1 );
seq.Append ( animateAlpha ( ..., 0 ) );
seq.AppendInterval ( 2 );
seq.Append ( animateJelly ( ..., 0 ) );
seq.AppendInterval ( 1 );
seq.Append ( animateAlpha ( ..., 0 ) );

Where all delays have to be put outside my helper method calls. I guess (I've 
seen that on the Unity forum) that is it the same for loops count.

Despite it makes thee code more complicated, because I have to put 
AppendInterval everywhere, and rewrite loops that are already made inside my 
helper methods, having behavior not working for tweens that are inside 
sequences is not what we expect first.

Maybe you should put a little explanation of that on the front page on your 
site.

Thanks for that great work !

Original issue reported on code.google.com by alexispa...@gmail.com on 28 Dec 2013 at 3:21

GoogleCodeExporter commented 9 years ago
You're completely right Alexis. I just added a note to the Sequence website 
documentation that explains that delays and loops won't work correctly :)

Original comment by daniele....@gmail.com on 29 Dec 2013 at 10:21

GoogleCodeExporter commented 9 years ago
Will you consider making loops and delays work in the future ?

Or is it possible to create an alternate Sequence class by myself ? must I 
compile it in the same assembly to access internal methods ?

Original comment by alexispa...@gmail.com on 30 Dec 2013 at 9:51

GoogleCodeExporter commented 9 years ago
Delays certainly not, because there's AppendInterval that achieves the same 
result. About loops, you made me doubt about it, but I prefer to avoid that 
because infinite loops would obviously not work. As of now, you can use a trick 
to let loops work in Sequences, like this:
Sequence.Append("1 second tween with 3 loops");
// Append an interval that will wait for the other 2 loops to complete
Sequence.AppendInterval(2);
// Continue filling the sequence

Original comment by daniele....@gmail.com on 30 Dec 2013 at 2:55

GoogleCodeExporter commented 9 years ago
The method AppendInterval is a replacement because delays don't work in 
Tweener, but I would prefer to use Tweener's delays instead, because of the 
same Tweener code have to be rewritten to work with sequence, with the need to 
add AppendInterval to make delays works. To me, not a good design choice.

If a Tweener is infinitely looping in a sequence, it's perfectly acceptable, 
it's even very useful if you have an effect that loops infinitely until it is 
ended programmatically. For example, consider an effect as a sequence with a 
beginning Tweener, an infinite Tweener (until a key is pressed) and an ending 
Tweener. Would be very useful.

What do you think ?

Original comment by alexispa...@gmail.com on 30 Dec 2013 at 6:59

GoogleCodeExporter commented 9 years ago
You're considering Sequences in the wrong way (I suppose you come from Flash, 
like I was?). They're not a Flash-like timeline, where separate movie symbols 
can play independently of each other, and thus infinitely looping tweeners 
inside a sequence would make sense. Instead they're like a regular movie 
timeline, where everything is tied together  and plays dependently of each 
other.

Can you ponder on what I wrote, and let me know your thoughts? :)

Original comment by daniele....@gmail.com on 3 Jan 2014 at 1:17

GoogleCodeExporter commented 9 years ago
Hi, I'm considering sequences as you describe them. I was used to Universal 
Tween Engine : 
http://www.aurelienribon.com/blog/projects/universal-tween-engine/
where you can create timelines that are sequences or parallels.

With UTE, a sequence being only a chained list of tweens, infinitely looping 
tween is perfectly allowed, and it's up to you to stop playing them if you want 
the following tweens to play.

In GoKit, 
http://forum.unity3d.com/threads/133823-Prime31-GoKit-Tween-Library-Live, they 
offers a GoTweenChain that is a sequence (with infinite loops, delays, etc) 
along with GoTweenFlow that looks like a timeline (and offers playing in 
parallels).

But anyway, I finally made my effect worked.
Thanks.

Original comment by alexispa...@gmail.com on 4 Jan 2014 at 2:59

GoogleCodeExporter commented 9 years ago
Glad you got your effects working. I will ponder more on the Sequence behaviour 
then, and see if I can add inner loops :)

Original comment by daniele....@gmail.com on 5 Jan 2014 at 10:27