Search Unity

HOTween: a fast and powerful Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Jan 7, 2012.

  1. Mr_Cad

    Mr_Cad

    Joined:
    Dec 7, 2013
    Posts:
    27
    Hi Izitmee,

    How can I achieve a shake effect in all directions randomly?
    Currently I noticed the shake direction is always from bottom left to upper right.
    What I want is a more natural way of shaking where it will shake in any directions instead of a fixed directions.

    Another question is what's the differences between Shake and Punch ?
     
  2. jingato

    jingato

    Joined:
    Jun 23, 2010
    Posts:
    299
    Hi, is it possible to start a tween position along a path using the HOTween Component and HOPath?
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @ks1364: I'm outta my testing environment today (and I never used HOPath), so I hope this code is ok. And by the way, you don't have to use Prop...rotation, because OrientToPath will take care of the orientation itself.
    Code (csharp):
    1.  
    2. HOTween.To(CubeTrans2, 20, new TweenParms()
    3.   .Prop("position", CubeTrans2.GetComponent<HOPath>().MakePlugVector3Path().OrientToPath(Axiz.Y),true)
    4.   .Loops(-1, LoopType.Yoyo)
    5.   .Ease(EaseType.Linear)
    6. );
    7.  
    (I used line breaks just for clarity, but you can write everything in one line if you want)

    @Mr_Cad: mhmm a randomer shake is not possible with the current easings. But you could try using an AnimationCurve for ease, to achieve some more pre-scripted randomness. About Shake and Punch difference, Punch ends up moving the target to a different position, while Shake doesn't.

    @jingato: sorry but no. HOPath (and PlugVector3Path) are not implemented in the Visual Editor. You'll have to use scripting for that.
     
  4. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Hello,
    First of all, thanks for your plugin, it's really nice. Second, how can I make tweens rewind themselves after they reach end without making a separate onComplete method. I am using HOTween editor, and I want to create a chain of tweens; it works the first time, but when I try to replay the chain, all the tweens get stuck at the end. It would be a very tedious job to rewind them from code, I hope there is a better way. Please help me.
     
  5. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hi Victor. To replay a tween from the start, you can simply do a myTween.Restart(). Or, to set a loop which reaches the ends, then plays backwards, then forwards, then backwards, and so on, you can set LoopType.Yoyo as the loop type.
     
  6. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    I do not want to set a loop, and I want to use only HOTween Editor. My problem is something like this: Tween1 > Tween2 > Tween3, a simple chain of tweens. They are connected through the onComplete event 'play by id'. When I play the chain for the first time everything is good, but when I try to play it the second time without having those tweens rewinded, nothing happens. I want the tweens to rewind themselves after they reach end. The ideal method will be a check box inside HOTween Editor just like the one that deletes them, but this one will rewind them after they finish. This is very important, because my designers can make most of the animations inside unity, without writing any code.
     
  7. amrakdab

    amrakdab

    Joined:
    May 23, 2013
    Posts:
    13
    Getting an error with HOTween Micro. My project is only basic, I downloaded the HOTweenMicro zip file and unzipped it into my Assets/Plugins folder. I have created a GameController script and included a reference to the hotween dll file. The namespace is recognised in Mono, but when I get back to Unity, I get the following error and can't do jack.

    Assets/Scripts/GameController.cs(3,7): error CS0246: The type or namespace name `Holoville' could not be found. Are you missing a using directive or an assembly reference?

    Trawled the internet for a few hours on this one, no luck. Your help would be appreciated.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hello to Rome :)

    bizilux1 reported some "miscalculations" on curved paths and posted a few images here, maybe you could take a quick look at them (the lines are drawn with the same code that calculates path points in HOTween/Core/Path.cs). Thank you!
     
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Victor_Kallai: let me understand better, so I can implement it efficiently, and see if it needs to be implemented at all.
    - How are you calling the first tween? Is it in autoplay?
    - How are you restarting the chain?
    - Are you sure you want the tweens to be rewinded AS SOON as they complete? Or you want them rewinded as soon as you play them again?

    @armkadab: that is very weird. What version of Unity are you using? Also, can you send me that project, since it's basic, so I can check out what's wrong?
     
  10. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hey Baroni! :) That is superweird :O Can you ask bizilux1 to reproduce the issue in a sample project and send it to us, so I can check it out better?

    EDIT: gonna ask him myself too, to make things faster ;)
     
  11. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    1. The first tween i call it when I press a button: HOTween.Play ("TweenId1");
    2. In order to restart the chain, each tween has an onComplete Send Message method like this:
    public void onCompleteTween1 ()
    {
    HOTween.Rewind ("TweenId1");
    HOTween.Play ("TweenId2");
    }
    3. I want them rewinded as soon as I want to play them again, this would fit the most cases.
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    One last thing to make me understand fully. Your tweens are all in a loop, meaning that when the last one ends, the first one should automatically restart (so that you can set simply a "play tween by id" option in the Visual Editor, to call the first tween in the group)?

    Also, you're saying you want them rewinded when you want to play them again, but in your example (answer n.2) you're rewinding them as soon as they're finished instead. Just asking to be sure of what to do.
     
  13. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    1. No, the animations are not in a loop.
    2. I know I rewind them as soon as they are finished, but I think that the other way makes more sense, and will fit most of the situations.
     
  14. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Ok, then an additional "restart tween by id" option in the Visual Editor should do the trick. Will see if I can work on it tomorrow :)
     
  15. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Wow, thanks a lot! I can't wait to try it :)
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    In the end, I did it immediately :)

    HOTween Visual Editor Update: v1.1.260
    - Implemented "Restart Tweens By Id" option in OnComplete dropdown

    Download latest version of HOTween and the Visual Editor from the website, and you'll find a "Restart Tweens By Id" option in the visual dropdown.
     
  17. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Thanks again Izitmee. I'll make sure to donate some coins, after I finish the game. Keep up the good work :)
     
  18. amrakdab

    amrakdab

    Joined:
    May 23, 2013
    Posts:
    13
    Hi Izitmee, just checking you got my pm, I sent it to you a couple of days ago and haven't heard back.
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Thanks to you Victor :)

    @amrakdab: sorry, I was enjoying the weekend. I'm on it now ;)
     
  20. amrakdab

    amrakdab

    Joined:
    May 23, 2013
    Posts:
    13
    I guess I can't hold that against you :)
     
  21. foq1978

    foq1978

    Joined:
    Aug 5, 2009
    Posts:
    41
    Congratulations on the great tool!

    However, for some reason -- and I am sure it's something I got wrong -- I cannot change the timeScale once the tweener has been created. What is wrong with my code?

    Thanks in advance

    Code (csharp):
    1.  void Start()
    2.     {
    3.         // HOTWEEN INITIALIZATION
    4.         HOTween.Init(true, true, true);
    5.  
    6.         // TWEEN CREATION
    7.  
    8.         myParms = new TweenParms()
    9.             .Prop( "position", CubeTrans1.GetComponent<HOPath>().MakePlugVector3Path().OrientToPath())
    10.                 .SpeedBased()
    11.                 .TimeScale(1.0f)
    12.                 .Loops(-1, LoopType.Restart)
    13.                 .Ease(EaseType.Linear);
    14.  
    15.  
    16.         // Changing the timeScale before creating the tweener does work...
    17.         myParms.TimeScale(5.0f);
    18.  
    19.         myTweener = HOTween.To(CubeTrans1, 1, myParms);
    20.  
    21.         // However, doing it after won't affect the tweener's timeScale. What is wrong?
    22.         myParms.TimeScale(2.0f);
    23.  
    24.  
    25.     }
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    You can't change parms after you finish assigning them to a tween. But no worries, you can still change the timeScale at any moment, by using the property on the Tweener itself :)

    Code (csharp):
    1.  
    2. myTweener.timeScale = 2.0f;
    3.  
     
  23. foq1978

    foq1978

    Joined:
    Aug 5, 2009
    Posts:
    41
    Fantastic! Thank you so much for answering.
     
  24. amrakdab

    amrakdab

    Joined:
    May 23, 2013
    Posts:
    13
    Just as a follow up on my problem with using HOTweenMicro and the namespace problem. The problem appears specific to when you are targeting the Windows Phone 8 platform. The current workaround is to move the plugin from the Assets/Plugins folder to an alternative folder. I have used Assets/Include.

    It is thought to be related to an existing bug in Unity 4.3.4f which should be addressed in Unity 4.5. We'll have to wait and see.

    Thanks Izitmee for helping diagnose the problem.
     
  25. amrakdab

    amrakdab

    Joined:
    May 23, 2013
    Posts:
    13
    Ok, now I got my bug out of the way, I've moved on to implementing some HOTween functionality. I am making a game using quads and an orthographic camera. I have one of my quads following a path down the screen and i am trying to use orienttopath to get the quad to rotate on the z axis to follow the path, however, it doesn't rotate at all. My camera looks down the z axis, while my quads are setup on the xy axis.

    Here is the sequence I have setup:

    Code (csharp):
    1.    
    2. path.Append(HOTween.To(transform, 10, new TweenParms().Prop("position", new PlugVector3Path(new Vector3[] {
    3.     new Vector3(-10, 5, transform.position.z),
    4.     new Vector3(-5, 3, transform.position.z),
    5.     new Vector3(-10, 2, transform.position.z)
    6. }, PathType.Curved).OrientToPath(true, 0.5f, Axis.X | Axis.Y))));
    7.  
    I have restricted the rotation on the x and y axis, which I think is what I want. What am I missing?
     
  26. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    The rotation is relative to the target's coordinates. So you will want, in that case, to just lock the Z Axis instead (or none at all, since with those waypoints there's no need). Also remember that the second OrientToPath parameter is the lookAhead percentage, not a value in units. Setting it at 0.5f will make your transform look way ahead.
    Oh, and also consider that, with orientation being relative to your target, you will have to put its "face" on the Z axis.

    That said, if you plan to use paths intensively, I would recommend Baroni's Simple Waypoint System, which uses HOTween and adds a lot more visual control over it.
     
  27. jingato

    jingato

    Joined:
    Jun 23, 2010
    Posts:
    299
    Hi, Is there any way to tween a uint using hotween? I tried it and I get a bunch of conversion exceptions.

    Thanks
     
  28. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I was wondering does a call to Kill, call the OnComplete callback?
     
  29. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @jingato: silly me. Actually, there isn't. I'll implement an automatic plugin for uints tomorrow or the day after.

    @Ben BearFish: no. Unless you call myTween.Complete() and then kill it.
     
  30. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    New HOTween Update v1.3.060

    - uint values are now correctly tweened (using automatic plugins)

    As usual, latest version is on the website

    @jingato: voilà :)
     
  31. jingato

    jingato

    Joined:
    Jun 23, 2010
    Posts:
    299

    You're the best!
     
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Well, thank you sir :)
     
  33. kafanasiff

    kafanasiff

    Joined:
    Sep 25, 2013
    Posts:
    31
    HOTween is really fantastic, thank you! I'm trying to get it to animate the color of a text mesh, but my code doesn't seem to be working. Can you tell what the correct way is? Thanks! Here is the last thing I've tried:

    HOTween.To(textMesh, 10, new TweenParms()
    .Prop("Color", new PlugSetColor(Color.red, EaseType.Linear, true))
    );
     
  34. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Glad you like it :)

    PlugSetColor is used to tween the color of a shader, since there's not a public "color" property in that case. If you just want to tween the color of a TextMesh, you can instead access its color property directly, and let HOTween find the right plugin automatically.

    Code (csharp):
    1.  
    2. // Note that in this case you'll have to apply the ease via
    3. // the Ease method parameter
    4. HOTween.To(textMesh, 10, new TweenParms()
    5.    .Prop("color", Color.red)
    6.    .Ease(EaseType.Linear)
    7. );
    8.  
     
  35. kafanasiff

    kafanasiff

    Joined:
    Sep 25, 2013
    Posts:
    31
    Fantastic, thanks! So easy :)
     
  36. Little-Big-Monkey

    Little-Big-Monkey

    Joined:
    Mar 4, 2014
    Posts:
    40
    Hello, I wonder why there is .mdb files in hotween folders now ? What are they used for ?

    Thx
     
  37. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    It's required in order for Unity to return the correct line numbers when logging events/errors/warnings that happen in scripts inside a DLL.
     
  38. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    First, congrats, I used iTween in my previous project and found it "OK but not that great", especially in terms of performances.
    So I looked around for a new tweening engine, found yours so I decided to give it a try.
    I rather enjoyed the performances showcased in your demo, comparing to iTween's :)

    On another hand, I've been a bit disappointed by the visual editor. Don't be mistaken: the editor is a fine job! It is really complete, pretty clear and all. So, Kudos for that, it is actually that (plus the perf showcase) that made me want to try HOTween.
    The part I'm sad about, I'm pretty sure you can't do anything about (and that's the saddest ;) ), as imho it's more about a structure/design POV:
    1. I don't really like that there are 2 distincts editors: the actual editor window and the components one can place on scripts. I believe there should be a way to gather them all, else you have to remember which one you put where.
    2. This leads me to the 2nd point: despite being actually awesome when willing to edit one tween, the editor window is pretty S***ty (sorry for the term, no offence intended!) once you start having many tweens, one can't find easily what he's looking for.
    3. The last one, which has been bugging me the most, is that all your tweens are computed once and for all, the only way to change some values is to reset their parms, even when set to relative. What I mean is, I actually thought that when using a tween set to relative, the start/end values would be recomputed every call! Think about a 3D runner-type game (temple run): I used HOPaths for the level, and was willing to use a single tween for lane changes, which would make my character move for a set distance to the right/left. But it's not possible as is, or I couldn't do it..

    Of course, I do rant, but I want to state again that appart from that, I actually like the way you implemented the whole thing, and will probably still use it. And about my example in the last point I made, I want to state that I actually could make it via code (changing the Props each call) so it's still fine, only I was really willing to create as many tweens via the editor as possible, so that the LD could easily access all those parameters, whereas now I have to implement him some interface ^^


    NOW, to the final part of my post (who said book?! ;) ):
    As stated earlier, I used the HOPaths, which were really appreciated, so thanks to Vesuvio for implementing that and thanks again to you for adding it, it's really nice.
    I found that it was missing a cool feature, which I was actually in need for, which I actually implemented: I found great the interface with the Vector3 Array as control points, but I really needed to be able to control them via actual transforms within the scene, so that I (in fact, my LD ;) ) don't need to match by hand the Vector3 points with our acual checkpoints/colliders/etc. from the scene.
    Small example as screenshot (one can see the editor on the right, and the cube I used as node 3 and 6)
    Here a brief of the features:
    • Still works fine like it used to, so if you don't wanna change it's fine.
    • Instead of having to choose the complete system you want to use (Vector3 or Transforms), you can mix them!
    • So for each entry in the list, you can link an optional Target (Transform); if so, the Target will override the usual behavior of this Point, meaning that the Point will have for values the Transform.position values.
    • The handles still work, even with a Target set! So once the target is setup, you can move both of them (the Target PLUS the associated Point) either by moving the Target within the scene, by using the HOPath handles or even using the usual Vector3 text inputs
    • You can of course link several Points to the same Target, they will all be updated when the Target is moved.
    • All the other features of HOPath are linked to it => you can still Add, Remove, Swap, Undo and even edit multiple paths at once.

    Just tell me if you're interested in adding this, if so we can discuss further so that I can give the sources to you.

    Keep up the good work!
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hey Le nain, thanks for all the feedback, the rant, the nice words and the HOPath additions :)

    Let me start with your points:
    1. Actually the Visual Editor was meant to be only the editor window, without the component. But then people asked for a reusable component (also so they could attach tweens to prefabs) and voilà. Indeed, a way to gather both of them would be cool. Still, the visual editor was never meant for tons of tweens (see next answer), so I don't know.
    2. Yup, it was meant for just a few tweens, and also as a study for something more advanced. But then Animator came out, and it looked exactly (with some further improvement) as what I had in mind. So, I improved HOTween's visual editor, but not as something that would easily (as in "visually") manage many tweens, since I supposed people would want Animator for that (which by the way, is now free, open source and seems to be managed pretty greatly by Sinfritz)
    3. Recomputing tweens at each update is a nono by design choice. That's because it would lead to many issues. Considering paths, it would mean checking at each update if a waypoint has changed, and if that happened, recompute the whole path algorithm, which is pretty expensive. Also, a good recompute should smoothly advance from the previous computation (especially in case values changed a lot), and that is a monster of a thing (though I'm planning to eventually do something like that for HOTween V2).

    About HOPath, I don't maintain it, and Vevusio seems to be kind of absent from the forums. So I suppose that, if you want to post mods to HOPath (and maybe open a thread for it, to keep things organized), that would be awesome. You could try to contact Vevusio via PM, to see if he answers, but I suppose he would be willing to see it improved :)

    By the way, each time paths are mentioned, I also have to suggest Baroni's Simple Waypoint System, which uses HOTween and is pretty slick.
     
  40. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    Hey, thanks for the fast answer.

    I'm gonna answer back real quick, because I'm cooking at the same time, and about to eat ;)

    First 2 points make sense! Thanks fot the intel.
    About the 3rd one, I may have not been clear enough: I understand one can't recompute tweens at each update, especially for paths. What I meant is I wished that, only for isRelative tweens, and not even paths, that when you Restart() it it would recompute the bounds of the path according to the gameObjects current state. For instance, your tween is [move right from 0 to 1, relative to you] => You play it once, your GameObject goes right by 1, and if you Play it again, it would go right by 1 again relatively to its position, and thus end at 2. Currently, it restarts completely if you don't Recreate a new tween, and thus would go back to 0 before going right by 1.

    And thanks for the SWS, it indeed looks noteworthy! I don't think I'll change for the current project, even if I'm not that far in, it's a small project (about 1 month) and I believe just using the standard HOTween + HOPaths with my latest addition will suffice, but I'll definitely put it in my checklist for later!
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Ah! I had understood Point 3 completely wrongly. Then... it's quite interesting and doable. Not by a simple Restart, since that is intended to restart the tween as it was, relative or not, and a lot of people (myself included) want relative tweens to behave always the same. But I could implement a different method (like RestartFromHere — ok I'll have to find a nicer name) which could do just what you asked.

    Lets take an int as an example, to understand the best implementation. The int starts from 2 and the tween ends it at 7, so it changes by 5. While it's tweening, and its value is currently at 4, you call RestartFromHere. Now you would expect the tween to restart from a time position of 0, but considering 4 as the starting point and 9 (4 + 5) as the end value? Is it correct?

    Hope the meal was nice by the way. My turn to eat now ;)

    P.S. only for loops, but there is a similar behaviour already: LoopType.Incremental, which increments the value at each loop cycle (in short, at each loop iteration the previous end value becomes the new start value, and the total change is applied as a new tween).
     
  42. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    About the P.S.: Good to know, didn't have to use loops yet but I'll sure keep that in mind ^^

    And about your example, that's pretty much it. And it's actually even simpler in my case, because it doesn't even have to be running, it's more like (taking your own example) it actually goes to 7, but next time I call it it goes (as you understood well this time) from 7 to 12. (Forgot to mention that in my example, it's set so that it doesn't autodestroy, precisely to achieve that behavior without recreating a new one ;) )
    Though your design is actually good, as my case can still be achieved with it.

    Enjoy your meal!
     
  43. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Good, I'll implement the IncrementalRestart (I like this name, possibly seems the more self-explanatory) method tomorrow. Unless it should prove to be less easy than what I'm imagining, and thus might take a little more time.
     
  44. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    Pretty cool, man.

    If possible (you'll see when implementing it, depending on the structure behind it), could you try doing it so you could set it via a flag (either a bool like isRelative, or using your standard looptype, even if I think it fits less as there might be some cases when you want to choose a specific looptype and still use this)? This way, I can see several advantages:
    • One can use it via code only, just like you said, calling RestartIncremental() on any tween.
    • If the tween is set to (let's call it that) isIncremental via the flag, this RestartIncremental() automatically replaces the standard Play() or Restart() or whatever is is you use, so that the dev user doesn't have to take both cases (1st time the tween is fired vs any time afterwards) into account everytime he's using one of these.
    • Finally, it would be easily integrated and set via your visual editor.

    Thanks.

    [EDIT] Do you have any way to contact Vesuvio? I can't PM him, he probably left the option unchecked. I could open a new thread as you stated, but tbh it would make more sense/accessibility to have Vesuvio replace his own package, keeping the link in his post you linked in your website (If he wants this update ^^).
     
    Last edited: May 14, 2014
  45. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi!,

    I would like to know if there is any way to replay sequences. I have cached a sequence this way:

    Code (csharp):
    1.  
    2.         _tweenSequence = new Sequence ();
    3.         Tweener t=HOTween.From(_comboMessageInstanceT,0.2f,new TweenParms()
    4.                              .Prop("localScale",new Vector3(0.3f,0.3f,0.3f))
    5.                              .Ease(EaseType.EaseOutBack));
    6.         _tweenSequence.Append (t);
    7.         _tweenSequence.AppendInterval (1);
    8.         Vector3 newPos = _comboAppearingPos;
    9.         newPos.x = -100;
    10.         t=HOTween.To(_comboMessageInstanceT,0.5f,new TweenParms()
    11.                      .Prop("position",newPos)
    12.                      .Ease(EaseType.EaseInBack));
    13.         _tweenSequence.Append (t);
    14.  
    Then, later I do _tweenSequence.Play() and the sequenced is played correctly. But if I try to play it again it doesn't work. I have tried to call Reset(), Rewind, etc... and the Play() and same result. Is there any possibility to reuse this or must I recreate the sequence every time?.

    Thanks in advance.
     
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @hexdump: Sequences (like Tweeners) are auto-destroyed by default when complete, so calling Play/Etc after that will have no effect. Just use the AutoKill(false) method parameter in your SequenceParms, and everything will work:
    Code (csharp):
    1.  
    2. _tweenSequence = new Sequence (new SequenceParms.AutoKill(false));
    3. ...
    4.  
    @Le nain: will do with the isIncremental :) But it will only replace Restart, since Play is used to exit from a paused state, which is another matter. About Vevusio, I don't have any other means of contacting him, and just talked with him here on the thread. Still, should you choose to create a new thread, you could link both Vevusio's original than yours, and I could link to the thread from HOTween's website.
     
  47. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Thanks a lot for the suggestion. As I always say HotWeen is awesome! :D.

    Just another question if you don't mind. Well they are 2:

    1) Does it have any extra cost to have the sequences cached? I see in the editor how HotManager is holding them paused. Don't know if it is calling update every frame on them or what happens.

    2) Is there something like Sequence to group a set of tweens that I want to execute at same time? It seems sequence is used for sequential tweens. I want something to play tweens in parallel at once without calling every tween Play everytime I need it.

    P.D. I found the solution for question 2 just inserting at same time in the sequence :).
     
    Last edited: May 14, 2014
    ChessMax likes this.
  48. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    I admit that I don't really see the deal here :/
    The Tweener set to isIncremental as I proposed (imagined) actually works when used in a paused state, doesn't it ? I mean, if it goes from 0 to 5, the first time you start it and let it finish until it's at the position 5; then, if not AutoKilled, it it actually paused, isn't it? Thus, it would indeed need a way to start from a paused state, which would be 5, and go to 10.
    But maybe we're actually saying the same thing, and it's just me misusing some of your actual terms like Play, Pause in a "general way" but which may have a particular meaning according to your code.

    And yeah, I'm probably going to make a thread, just like you said, if we can't contact Vesuvio by ourselves ;)
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @hexdump: glad you solved question 2 already :) About question 1, no problems in caching Sequences (or Tweeners). If you reuse them, it's actually way better than creating a new one each time (I personally create all tweens when a scene starts, and play them when needed). No update is called every frame if they're paused, since HOTween uses a centralized controller which asks tweens to update only if they're not paused nor completed.

    @Le nain: yes, but what if you pause a tween before it finishes? If isIncremental replaced Play, you would not be able to simply continue the tween without "igniting" the incremental restart :p
     
  50. Le-nain

    Le-nain

    Joined:
    Nov 26, 2012
    Posts:
    62
    I see.
    What about (I just had a look), checking within the Play() if the tween is isIncremental, and if so, checking if isComplete? This could maybe satisfy both use cases, as if isComplete it would then restart from its current pos, else it would juste resume its current tweening.
     
    Last edited: May 14, 2014