HOTween: a fast and powerful Unity tween engine

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

  1. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Hello,

    I worked on this a lot, and it's finally ready...

    HOTween is a fast, type-safe object-oriented tween engine for Unity, compatible with all of Unity's scripting languages.
    It's free, easy to use, and comes with many options, among which the possibility to create sequences of tweens that are controlled as a single animation.
    Oh! And now it also comes with a Visual Editor! :)

    You can download it and find a lot more info here: [​IMG]

    Key Features
    Animation speed
    HOTween is VERY fast and reliable. Just check HOTween's Test Run and see for yourself.
    Fast scripting
    Coding-wise, HOTween is built so that code-assist will immediately show you all the available options, while helping you to auto-complete them quickly. Also, when using plugins, just write "Plug" (or even "Pl" is enough), and code-assist will show you all the available ones.
    Type-safety
    The only string you will have to write is the name of the property to tween. All the rest is fully integrated into code-assist and auto completion.
    Multiple update choices
    Each tween can be independently set to update at each Update, LateUpdate, FixedUpdate, or to use a special time-independent update, which will not be influenced by changes to Unity's internal timeScale (useful to animate GUI elements while a game is paused).
    Make it simple, make it complex
    You can write a simple tween just like this:
    HOTween.To(myObject, 1, "myProperty", 2);
    or you can create complex animations of multiple properties, with all the parameters you want, and nest them inside Sequences: both of them are controlled in the same easy way.
    Loops
    You can create simple loops (X to Y, then restart), yoyo loops (X to Y, then Y to X and repeat), plus yoyo inverse loops, which work like yoyo loops, but invert their easing when moving back to the original position. You can set the exact number of loops you want, or let them go on forever.
    Time scale
    You can set different time scales for every tween, and you can change them even while the tweens are running.
    Plugins
    HOTween automatically detects the type of property you are animating, and applies the relative default plugin. But you can always choose another one (for example, when you animate a Vector3, you can decide to use a plugin which will animate only one of the axis, or combine them anyway you want).
    Callbacks
    Easy to set callbacks, to invoke the function of your choice (public, private, static, whatever) when something happens during the animation.
    Common Interface
    Is it a Tweener or a Sequence? Who cares? They both share the same IHOTweenComponent interface, thus you can control each of them in the same way.
    Powerful controls
    A full range of controls: Play, Pause, Reverse, Rewind, Restart, Complete, GoTo, GoToAndPlay.

    HOTween Visual Editor
    A single dockable panel, to which you can add all the targets and properties you wish to tween in each scene, allowing you to tween everything, including any attached MonoBehaviours properties and fields.


    NEW! HOTweenComponent
    Works like HOTween Visual Editor, but can be attached to a GameObject, to tween only its Components. Works greatly with prefabs :)

    A note on iTween
    I'd like to note that HOTween doesn't aim to be "better" than iTween. Simply put, it's a very different engine, more object-oriented than gameObject-oriented, for different coding tastes, and both can work quite well together.

    A note on the name
    Nope, the name doesn't derive from HOT + Tween: it's just that my tiny company was named Holoville, and thus I usually place a HO in front of my scripts, to recognize them more quickly. Also, I had no idea of the slang meaning of "tween". Now that I do, I see I gave it the most ridiculously horrible name ever. HOTween V2 will definitely not be named HOTween :p

    -------------------------------------------------------
    EDIT additional comments on the ridiculousness of the name
     
    Last edited: May 17, 2014
    rakkarage and ToanZ like this.
  2. seon

    seon

    Member

    Joined:
    Jan 10, 2007
    Messages:
    1,404
    Wow, this is very fast compared to iTween.. assuming your example comparison test is real :)
     
  3. DanTreble

    DanTreble

    Member

    Joined:
    Aug 31, 2010
    Messages:
    515
    Looks great!

    Lost a little bit of excitement when I saw the .dll, I hope it is bug free :p

    Sell me full source on the asset store :)
     
    Last edited: Jan 7, 2012
  4. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @Seon: the comparison is real, and I think I done a good work about keeping it really "equal" on both side. But you're right to doubt. I wanted to post the code for the example, but I started feeling tired. I will do it tomorrow :)

    @DTreble I know, but I really can't live without packages :p Anyway, I plan to release the free full source soon (though it will still need to be compiled into a DLL in order to work - just to avoid messing up with other Unity classes that might have the same names). And in the meantime I will quickly fix eventual bugs (I've been testing it quite thoroughly, but obviously something will come out :p)
     
  5. seon

    seon

    Member

    Joined:
    Jan 10, 2007
    Messages:
    1,404
    @lzitmee: I wasn't doubting, hence the smily face. It was an impressive speed comparison, especially at 1000+ cube counts.

    BTW, are you aware that iTween 3 is very far in development and it's massively faster?
     
  6. DanTreble

    DanTreble

    Member

    Joined:
    Aug 31, 2010
    Messages:
    515
    Code can be in a namespace independently of being in a DLL. DLL is not equivalent to a namespace. In my understanding
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    25,908
    Not in Unity.

    --Eric
     
  8. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @Seon: Thanks for not doubting then :) Actually I heard about iTween 3 (though I probably saw a speed demo that wasn't complete), and I'm very curious about it. Anyway, when I started HOTween, I wasn't expecting it to go this fast. The main reason I started it was that I wanted a more object-oriented tween engine than iTween (which I greatly respect, but it simply doesn't suit my coding tastes/habits).

    @DTreble: yup, but in Unity you can't have two CS files with the same name, even if they're in different folders and with different namespaces. Unless they're DLL :p
     
  9. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Posted a UnityPackage with the speed test comparison. You can get it here (linked in the test description).

    More examples coming soon :)
     
  10. Jake L.

    Jake L.

    Member

    Joined:
    Oct 17, 2009
    Messages:
    246
    Sounds nice! Is this code based only or can we "click-create" tweenings in the editor as well?
     
  11. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    It's code based only. I never thought click-create editors to be very useful. Though, now that you mentioned it, I think it would be fun to see if I can quickly do it. I'll give it a try, while I'm still under the influence of code-adrenaline :)
     
  12. Jake L.

    Jake L.

    Member

    Joined:
    Oct 17, 2009
    Messages:
    246
    That's good. Sometimes it's handy to change&play things on the fly and convert it to static code once it's working well. Though that's a coder's point of view, artists prefer playing all day ;)
     
  13. wesllg

    wesllg

    New Member

    Joined:
    Jan 8, 2011
    Messages:
    18
    Looks great. I've been wanting some time to implement my own type safe tweening system for Unity for a while. Looks like you've done the job for me. Itching to give it a go and will do so soon. Thanks for the hard work.
     
  14. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @Jake L.: hey, who doesn't like to play all day. It's simply that what coders describe as "playing", artists describe as "being a nerd" :D And I'm definitely being a nerd now: totally into the click-create thing, trying to see if some interesting ideas I got will actually work.

    @wesllg: thanks for the nice words :) Eager to know what you'll think about it.
     
  15. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Hey, just created a "click-create" visual editor for HOTween (thanks to Jake L. enticing me to do it). You can also see a demo/tutorial video in the first post.

    Any feedback would be greatly appreciated :)
     
  16. iisjreg

    iisjreg

    New Member

    Joined:
    Mar 25, 2011
    Messages:
    101
    Nice one!
     
  17. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    898
    Absolutely crazy and fantastic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Congratulations Izitmee for your click and create version !!!

    6R
     
  18. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @iisjreg: thanks :) And by the way, Woodenvan looks great: love the mood.

    @p6r: thanks a lot!!!!!!! :) I thought it would be easier but then I came out with the idea of the "click&tween everything" interface and development became hell, but I managed in the end :p
     
  19. pixelsteam

    pixelsteam

    Member

    Joined:
    May 1, 2009
    Messages:
    671
    Really great work. Impressive!!

    Lame question is this PC only? As I saw it has a dll to install.
    Is there a OSX installer?
     
    Last edited: Jan 15, 2012
  20. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @24pfilms: Hey thanks a lot :)
    Actually, I have to admit that I'm quite ignorant about Mac, and I don't have one on which I could make tests. But HOTween DLL is not a true plugin, but a simple assembly, thus it should work in OSX too. Could you try it and let me know (I'm being shameless by asking, thus do it only if it's not a problem)?
    If it shouldn't work, I'll think about converting the DLL as full open source code. Though that would be bad, due to the fact that Unity doesn't support namespaces, and thus I'd have to prefix all classes so they don't mess with existing ones :(
     
  21. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    898
    Yes... The more you want to make it easy for the users, the more it will be hard for you to code ! :)
    It's the problem with all the click/create systems...

    But it could be a big challenge for you !!!

    Or why not 2 versions ? Maybe a click/create version with less options because of the limits of this kind of system, but very useful for the beginners or non-coders !?!
    When people have more experience with Unity and HOTween, they can use the other one with more options and another interface !?!
    So your plugin is great for ALL !!!

    6R
     
  22. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Ahaha, true. Though actually putting all the classes out of a DLL wouldn't be difficult at all, and wouldn't change click-create at all :) It's just that I'm an obsessive guy and love namespaces. But you got me here... I think I'll make it all open-source today, if I have the time (where is a nerd smiley when I need it? :B)
     
  23. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    898
    YOU MUST have the time... :):):)

    6R
     
  24. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Siiiiiigh!!! I did it. But I just discovered that, if not using a DLL, all internal members are considered public (yup, I'm dumb, I didn't realize that they're relative to assemblies and not to namespaces, as in ActionScript)! This is kind of terrible and breaks everything :(

    Now I'm gonna rest a little and then find a solution: anybody has some advice?
     
    Last edited: Jan 16, 2012
  25. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Whew! Ok, I finally decided that decent code-completion is too important, thus I can't go without internal members. This means that HOTween will stay as a DLL (though as a simple assembly), but I made it fully open source on Google Code (here). As usual, documentation, Visual Editor, etc. stay on HOTween official website.

    A note for Mac users
    Seeing that HOTween DLL is a simple assembly, and not a plugin, it should work on Mac too, without having to be recompiled. If anyone could try it out and let me know if it's true (there are mixed informations online) I would be immensely grateful. You can do it by just downloading the test run example package (here), and importing it into a new Unity project: if it gives no errors and it plays, it works :)
     
    Last edited: Jan 16, 2012
  26. MaDDoX

    MaDDoX

    Member

    Joined:
    Nov 10, 2009
    Messages:
    696
    This is outstanding Izitmee, congratulations! Maybe my partner Sandro or Unity's Rodrigo have an idea or two about how to make things work as you need yet without needing a DLL, I'll check back with him/them. TA.
     
  27. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Hey thanks a lot MaDDoX, it's a great compliment coming from Mr. RageTools, and now you got me all excited to know if you guys will come up with some idea for DLLness. Thanks for checking :)
     
    Last edited: Jan 16, 2012
  28. hima

    hima

    New Member

    Joined:
    Oct 1, 2010
    Messages:
    179
    Just look through all the examples and I love how it's looking so far. The speed test is impressive, and I love the adding text tween. I'm working on a visual novel engine that i want to release it for free as well so this is going to be a big help ^ ^
     
  29. zcycool

    zcycool

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    1
    Great work , it's really faster than iTween.
    Some wishes :
    . Can I animate an object along a path by speed but not duration?
    . I'd like to have a property or method for whether to generate a curve from the object's current position to the beginning of the path,I don't want to change my preset way-points array or deep copy it.

    ----------------
    I'm using it on Mac OS X 10.6.8 and it works no problem..

    BUT...it's not support to iOS?
    When I compiled on iPhone, I got error messages like this:

    ExecutionEngineException: Attempting to JIT compile method 'Member:.ctor ()' while running with --aot-only.

    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
    at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
    at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
    at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
    at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
    at System.Reflection.Assembly.CreateInstance (System.String typeName, Boolean ignoreCase) [0x00000] in <filename unknown>:0
    at System.Reflection.Assembly.CreateInstance (System.String typeName) [0x00000] in <filename unknown>:0
    at FastDynamicMemberAccessor.MemberAccessor.EnsureInit () [0x00000] in <filename unknown>:0
    at FastDynamicMemberAccessor.MemberAccessor.Get (System.Object target) [0x00000] in <filename unknown>:0
    at Holoville.HOTween.Plugins.Core.ABSTweenPlugin.GetValue () [0x00000] in <filename unknown>:0
    at Holoville.HOTween.Plugins.Core.ABSTweenPlugin.Init (Holoville.HOTween.Tweener p_tweenObj, System.String p_propertyName, EaseType p_easeType, System.Type p_targetType, System.Reflection.PropertyInfo p_propertyInfo, System.Reflection.FieldInfo p_fieldInfo) [0x00000] in <filename unknown>:0
    at Holoville.HOTween.TweenParms.InitializeObject (Holoville.HOTween.Tweener p_tweenObj, System.Object p_target) [0x00000] in <filename unknown>:0
    at Holoville.HOTween.Tweener..ctor (System.Object p_target, Single p_duration, Holoville.HOTween.TweenParms p_parms) [0x00000] in <filename unknown>:0
    at Holoville.HOTween.HOTween.To (System.Object p_target, Single p_duration, Holoville.HOTween.TweenParms p_parms) [0x00000] in <filename unknown>:0
    at HOTweenTest.Move () [0x00000] in <filename unknown>:0
    at HOTweenTest.Start () [0x00000] in <filename unknown>:0
     
    Last edited: Jan 18, 2012
  30. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @himatako: glad you like it, and I'm an avid book reader (currently reading George R. R. Martin's "A song of ice and fire", and as soon as I finish it I'm going for Joyce's Ulysses - read it in Italian ages ago, but now I'm curious to read it in English), thus I'll be looking forward to your visual novel :)

    @zcycool: thanks for the appreciation, and thanks for the suggestions + bug reporting :) About that:

    Added it as enhancement on Google Code, and will start working on it today (along with another special type of loop I thought of this morning).

    It's already there. You can use method chaining to add the ClosePath() parameter, and it will be automatically closed:
    Code (csharp):
    1.  
    2. ...Prop( "position", new PlugVector3Path( path ).ClosePath() )...
    3.  
    Or you're meaning something else?

    Didn't have the chance to test it on iOS. Added it as a defect, and will look through it today.
     
    Last edited: Jan 18, 2012
  31. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @zcycool: sorry, I just evidenced this on HOTween's website:HOTween is not compatible with iOS (EDIT: not true anymore, solution found but still needs to be tested).

    That's because iOS uses a different compilation mode (AOT) than the other types of build (JIT), and it doesn't support Reflection. I tried to find a solution, but definitely there's none. HOTween is fully object-oriented thanks to the way it uses Reflection, and using something else would limit it greatly.

    Thus, sadly, for now there is no viable alternative. Though I'll go on looking and hoping something will change (but probably won't, at least in the near future).

    P.S. in the meantime, I'm working on the "tween by speed" option, trying to implement it in the best possible way not only for movement along a path, but for everything.
     
    Last edited: Jan 19, 2012
  32. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Uhm, sorry for double posting, but I found that it's not the whole Reflection class that is unavailable on iOS, but just Reflection.Emit. Thus I'm again working on finding a compatible but still speedy iOS solution :)
     
  33. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @zcycool: did it! Now it should be iOS compatible (hopefully). Could you test it please? :)

    Now I use a conditional way of accessing properties/fields in case Unity is running on iOS. This makes HOTween a little slower (only on iOS - I'll upload an "iOS" option to the test run if this works), because it uses simple Reflection instead than the iOS unsupported Emit.

    To test it: download HOTween_0_8_005_beta.zip from Google Code
     
    Last edited: Jan 19, 2012
  34. apparition

    apparition

    New Member

    Joined:
    Jan 11, 2012
    Messages:
    48
    I just came here to report the same iOS bug as zcycool. I didn't expect there to be a fix already! I'll give it a try right now.
     
  35. apparition

    apparition

    New Member

    Joined:
    Jan 11, 2012
    Messages:
    48
    Well, my tweens are now working on iOS. I'd say the fix looks good. :)

    This is a fantastic tweening engine you've got here, Izimtee. Keep up the great work!
     
  36. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Great! Thanks a lot for testing it apparition (and for the appreciation) :) Now I'm going to sleep, but tomorrow morning I'll add the iOS option to the test run, so you can see the actual speed difference even from a PC/Mac.
     
  37. hima

    hima

    New Member

    Joined:
    Oct 1, 2010
    Messages:
    179
    Finally got to try this and I'd have to say it's really really easy to use! Within 15 minutes, I have a dialogue box with typewriter effect for the text that can be fast forward by holding the spacebar. It's that easy!

    One thing I'm wondering about is that, is it possible to reuse Tweener? This is so that we can keep the same Tweener, and restart it with new TweenParams if we want. I came from FlashPunk's Tweener classes, and they allow you to do this. My understanding is that this is efficient because you don't have to create a new Tweener instance everytime you want to Tween something. I could be wrong, and if there is a reason why this shouldn't be the way it works, I'd love to hear it :)

    Anyway, excellent work on this! And thank you for making it free. I'm going to donate now ^ ^

    Keep up the good work!
     
  38. S0ULART

    S0ULART

    Member

    Joined:
    Jun 14, 2011
    Messages:
    126
    @himatako:
    could you explain how you did this dialogue box with typewriter effect? I'm wondering how you can handle such things with Hotween :S Thought you can only get this by using code.
     
  39. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @himatako: hey thanks a lot for the donation, you were very kind (and my first donator! :)). I'm very glad you're finding it easy to use. I use it very quickly and easily in my projects, but obviously I'm always unsure if it's just me :)

    Didn't know about FlashPunk's Tweener classes (when doing Flash, I'm totally into Greensock's tweening engine, though I'll have a look at them now). Let me understand better the concept of re-usable Tweeners: I suppose you mean being able to keep the Tweener with its target and Props, while being able to change all the other parameters? If that's what you meant, I already have an idea: seen how HOTween is built, I think I could easily allow to change all the parameters (Props and target excluded) even in mid-play. I will probably be able to do it within the week (next 2 days I'll be busy moving from Rome to Nis, and right now I'm implementing a "move by speed" option). If you meant something else, do tell me and I'll certainly look into it (or tell you why it shouldn't work like that :D).

    @S0ULART: If himatako doesn't have the time, I'll do this as an example within the week (next 2 days I'll be too busy to do it). Though consider that the dialogue box will need to be done via script, while the text/string tween can be done both via HOTween script, than with the Visual Editor (I'll implement a larger text box when you choose to tween a string, so it'll be easier).
     
    Last edited: Jan 23, 2012
  40. hima

    hima

    New Member

    Joined:
    Oct 1, 2010
    Messages:
    179
    @Izitmee
    Yes, that's exactly what I mean!

    For more explanation, I used to make a shoot'em up game, where recycling object is a must. So each type of bullet will appear or disappear differently. Some appears by scaling up, some appears by fading in, and so on.

    With iTween, even though I reuse the same bullet object, but each bullet object always create a new iTween instance. If I can reuse Tweener, then I can make it so that each Bullet has a scaleTweener and alphaTweener, then when the bullet appear, I can just reuse these tweeners with different parameters.

    As for donation, it'll come :) Or you can do the same as iTween. The library is free, but tutorials and some advance technique examples are not ( They are $1 each ). So it's like donation in a way.

    @S0ULART
    My dialogue box is basically a TextMesh on top of a PackedSprite from SpriteManager2 ( Though it can be anything really, since it only serve as a background. I'm thinking about moving to Orthello2D )
    Then it's just a matter of applying the tween to the text. You need to use plugin though, since you can't tween a string parameter by default.

    Code (csharp):
    1.  
    2. string textToType = "Hello, World";
    3. float timeTakenPerCharacter = 0.1f;
    4. float totalTimeTaken = timeTakenPerCharacter * textToType.Length;
    5. HOTween.To(textMesh, totalTimeTaken, new TweenParms().Prop("text",new PlugString( textToType, EaseType.Linear ) ) );
    6.  
    Fast forwarding the text is just changing Time.timeScale. Though, I think it's better if you only change the timescale of the Tweener, so it won't affect the whole game.
     
  41. SteveB

    SteveB

    Member

    Joined:
    Jan 17, 2009
    Messages:
    1,002
    I second Himatako's suggestion. One thing I attempted to do with iTween was to use it for an FPS camera bobbing motion that was character speed dependent, but I was unable to adjust the 'bob' amount on the fly; iTween needs to finish what it's currently doing before a param can be adjusted.

    Having the abillity to have constant motion every frame with all subsequent eases and be able to adjust this smoothly on the fly, mid-tween, for greater or lesser motion, would be ideal.

    Good stuff here Izitmee. :D
     
  42. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    @himatako: oops! Actually, strings should be able to be tweened by default, without using a plugin. Just added this option and it will be available in the next update (with those other options).

    @SteveB: what you're suggesting looks like an interesting addition to what Himatako said, I'll try to add it too. As of now, I planned to add the possibility of changing easing, loops, etc. on the fly, but not the "end value" to reach, which instead I suppose you're referring to. I'll definitely look into it within the week (right now I'm totally stuck into allowing tweens to animate with constant speed along a Catmull-Rom path: I thought I contrived a kind of inexpensive and fast way to do it, but though the logics and implementation look correct, it's not working :p).
    P.S. hey it's an honor to see you checking HOTween, seeing your incredible curriculum :)
     
  43. pixelsteam

    pixelsteam

    Member

    Joined:
    May 1, 2009
    Messages:
    671
    Is the OSX version ready for primetime yet?
     
  44. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    zcycool and apparition used it on OSX, and it gave them no problems. Seen that HOTween's DLL is just an assembly, it works both with Windows than with Mac :)
     
  45. ShreddinPB

    ShreddinPB

    New Member

    Joined:
    Aug 18, 2011
    Messages:
    79
    Hey guys, just found this as I was looking for a way to replace iTween due to so many Destroys() slowing down my game on android.
    I really just got into it and am wondering if there is a way to see the code that the visual editor creates? I am pretty sure this was asked about already in the thread but I didnt see a answer.. might have just missed it since I am distracted at work lol

    That would make it super simple to learn it ;)
     
  46. ShreddinPB

    ShreddinPB

    New Member

    Joined:
    Aug 18, 2011
    Messages:
    79
    Ok, Now I have some questions ;)

    I am trying to make a count down timer to start my game.. I tried 2 different methods neither of which I could get to work correctly.. here is what I tried

    First I tried using OnCompletes
    Code (csharp):
    1.        
    2. void startCountDown()
    3.     {
    4.         if(doCountDown)
    5.         {
    6.             HOTween.To(numParent.transform, 1, new TweenParms().Prop("position", new Vector3(16,countDownYonScreen,-92)).OnComplete(countDownThreesLocal));
    7.         }
    8.     }
    9.    
    10.     public static void countDownThreesLocal()
    11.     {
    12.         HOTween.To(numThree.transform, 1, new TweenParms().Prop("localScale", Vector3.one).OnComplete(countDownTwosLocal));
    13.     }
    14.    
    15.     void countDownTwosLocal()
    16.     {
    17.         numThree.transform.localScale = Vector3.zero;
    18.         HOTween.To(numTwo.transform, 1, new TweenParms().Prop("localScale", Vector3.one).OnComplete(countDownOnesLocal));
    19.  
    20.     }
    21.    
    22.     void countDownOnesLocal()
    23.     {  
    24.         numTwo.transform.localScale = Vector3.zero;
    25.         HOTween.To(numOne.transform, 1, new TweenParms().Prop("localScale", Vector3.one).OnComplete(countDownDoneLocal));
    26.     }
    27. void countDownDoneLocal()
    28.     {  
    29.         print("COUNT DOWN DONE!");
    30.         numOne.transform.localScale = Vector3.zero;
    31.         HOTween.To(numParent.transform, 1, "position", new Vector3(16,countDownYoffScreen,-92));
    32.     }
    33.  
    When I do it this way, each number scales up twice. Three scales up then down, then two and three scale up then down, then two and one, then one.


    then I tried using a sequence
    Code (csharp):
    1. void startCountDown()
    2.     {
    3.         if(doCountDown)
    4.         {
    5.             //countDown sequence
    6.             Sequence theCountDown = new Sequence(new SequenceParms().OnComplete(countDownDoneLocal));
    7.            
    8.             theCountDown.Append(HOTween.To(numParent.transform, 0.01f, "position", new Vector3(16,countDownYonScreen,-92)));
    9.             theCountDown.Append(HOTween.To(numThree.transform, 0.99f, "localScale", Vector3.one));
    10.             theCountDown.Append(HOTween.To(numThree.transform, 0.01f, "localScale", Vector3.zero));
    11.             theCountDown.Append(HOTween.To(numTwo.transform, 0.99f, "localScale", Vector3.one));
    12.             theCountDown.Append(HOTween.To(numTwo.transform, 0.01f, "localScale", Vector3.zero));
    13.             theCountDown.Append(HOTween.To(numOne.transform, 0.99f, "localScale", Vector3.one));
    14.             theCountDown.Append(HOTween.To(numOne.transform, 0.01f, "localScale", Vector3.zero));
    15.             theCountDown.Append(HOTween.To(numParent.transform, 0.01f, "position", new Vector3(16,countDownYoffScreen,-92)));
    16.            
    17.             theCountDown.Play();
    18.         }
    19.     }
    20.  
    21.  
    22. void countDownDoneLocal()
    23.     {  
    24.         print("COUNT DOWN DONE!");
    25.     }
    26.  
    this has the same type of effect.. numThree scales up, then resets to zero, then when numTwo scale up, numThree scale up again. This happens for all numbers and calls the OnComplete twice at the end.
     
  47. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    Hey ShreddinPB, glad you're trying HOTween :)

    In your example, Sequence is definitely the way to go. I tested it out, and it works perfectly: are you sure that "startCountDown" is not called multiple times? I built a working sample, using exactly your code, and everything runs as expected.

    You can get the UnityPackage with the sample "Counter" scene I created to test it out here (HOTween DLL is not included, you will have to add it, or just import the package in your current project). I used your code, and placed it inside "CounterBrain.cs", which is a MonoBehaviour attached to the empty gameObject "_Brain", and I used colored cubes instead of numbers to do it more quickly (I have to rush to get a plane).

    About the Visual Editor, it is not a code generator (and nope, nobody asked that question yet), thus there's no way to see its output. But I might create a visual helper that does that.

    Also, I'm sorry but I'm leaving now and will be travelling for two days, thus I'll be back to the forums only on thursday (timezone is GMT+1) :p
     
    Last edited: Jan 24, 2012
  48. S0ULART

    S0ULART

    Member

    Joined:
    Jun 14, 2011
    Messages:
    126
    Thank you very much Izitmee and Himatako
    I'm going to check it out hope i#ll get it to work with my less coding skills lol
    great that you responded that fast and detailed!
     
  49. ShreddinPB

    ShreddinPB

    New Member

    Joined:
    Aug 18, 2011
    Messages:
    79
    There is no need to be sorry! ;)
    I will double check everything then, when I was using iTween it wasnt getting called twice (or wasnt acting like it was) so I assumed it was only calling once.. I will trace and find out where my code is wrong!

    Thanks for looking into it!
    Have a great trip :)
     
  50. Izitmee

    Izitmee

    Member

    Joined:
    Jan 27, 2011
    Messages:
    2,414
    New update (v0.8.006) :)

    • You can animate with constant speed along a path (chaining the ConstantSpeed parameter on the PlugVector3Path plugin).
    • You can make speed-based instead than time-based tweens (chaining the SpeedBased parameter on TweenParms).
    • String properties can be animated using defaults (meaning they don't need PlugString to be used directly).

    Now moving to the implementation of runtime parameter changings.

    P.S. ShreddinPB, the trip was terrible, but now that I arrived I'm happy :D Let me know if you find what was wrong or if you need more help.