Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

HOTween: a fast and powerful Unity tween engine

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

  1. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    I think everyone wants a good timeline, flash-like animation editor, but some things did make me hold my horses. First and foremost, because Unity has shown alpha screenshots of its future animation system, a proper central-timing based system like Flash does it, and with a hugely improved timeline editor. The second reason is that interpreting your own custom keyframe format not only contributes to the custom-plugin babel tower, it will also never have as good performance as a real native animation clip. Not to mention that replicating all the curve editing functions the animation window already has is too tedious and work-demanding for something that'll probably break when the next Unity animation system kicks in.

    Now, thinking of it, a really cool addition for iTween would be a "bake keyframes" to generate an animation clip (one keyframe per frame) from a regular tween :)
     
  2. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    Can you please share some more details on this, maybe a link? :) What do you mean by "future animation system"? Where, what, who? :D

    Thanks! ;)
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Woah I want to know the where, what, who too! :D A native animation system would obviously be super-awesome! But I totally missed that piece of news.

    And why are you talking about iTween here MaDDoX? Ahahahaha :D I never took animation clips into consideration, but I will definitely check them out more. I think I understood what you meant, and that sounds cool!
     
  4. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    Hmm...interesting idea...trying to create AnimationCurves corresponding to the tweening functions and embed the created AnimationCurves into a native AnimationClip...could be the stuff of legend. After all, for example a linear interpolation for translating a cube from point A to point B can also be dynamically created using AnimationCurves in an AnimationClip created from code thus using the native animation system from unity.

    But what also gives power to HOTween is that it can do Sequences of animations that are easily and dynamically controlled at run-time, which the current animation system from Unity doesn't support.

    But it would be interesting to have a possibility to bake tweens into Unity native AnimationClips. Hmmm...
     
  5. hexdump

    hexdump

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

    Is there any way to catch tweens? I would like to create 4 tween objects and keep them in vars. I want to play them when needed. Don't want the tween engine to keep creating tweens everytime I need one. I need this because I will tween some GUI buttons very frecuently.

    Thanks in advance.
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @hexdump: sure! When you create a tween with HOTween.To(...) it returns a Tweener object, which you can store and activate whenever you want. Consider that when storing tweens that are reused multiple times, you should add the AutoKill(false) method parameter, so the stored tween won't be killed after completion - and you might want to add the Pause() method parameter too, so it won't start automatically the first time.

    @floky: hmmmm...
     
  7. Madgeniy

    Madgeniy

    Joined:
    Apr 21, 2012
    Posts:
    14
    Hello! Is it possible to use HOTween.To() in Update method of MonoBehaviour like MoveUpdate in iTween? Thanks.
     
  8. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hello Madgeniy! I'm not sure what MoveUpdate does exactly. Could you tell me more of what you'd like to achieve?
     
  9. Madgeniy

    Madgeniy

    Joined:
    Apr 21, 2012
    Posts:
    14
    I want to use HOTween.To in Update method to move transform and achieve good FPS. iTween allows it.
     
  10. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Sorry Madgeniy but I used iTween long ago and only for a short while, and never used MoveUpdate, so I'm not sure of how it works nor of its advantages.

    If you mean you want to change a tween's end values at each update, I'm sorry but that can't be done without creating a new one. If instead you want to change something else, tell me more, and I might help you. Things like speed/position/etc, are made to be changed even inside an Update.
     
  11. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    That's among the shortest and direct feedbacks in this forum. :))
    I know the answer to that!

    Use iTween! :)
     
  12. imkira

    imkira

    Joined:
    Dec 26, 2011
    Posts:
    39
    Hi everyone, I started using HOTween as of lately and I have been unsuccessful to find anyone who has shared code for making "shake" position/scale/rotation tweens like iTween.Shake* family of functions.

    I am posting the code I made for the plugin I decided to call "PlugVector3Shake" which is based on the original source code of PlugVector3 (I basically just made changes to the DoUpdate function).
    There are some small limitations as of know, like you can Yoyo the tween but since it just randomly shakes it does not play in backwards direction exactly like in the forward direction of the tween. Nevertheless be my guest to take it and improve it as you like.

    Code (csharp):
    1.  
    2. using System;
    3. using UnityEngine;
    4.  
    5. namespace Holoville.HOTween.Plugins.Core
    6. {
    7.   /// <summary>
    8.   /// Plugin for the "shaking" of Vector3 objects.
    9.   /// </summary>
    10.   public class PlugVector3Shake : ABSTweenPlugin
    11.   {
    12.     // VARS ///////////////////////////////////////////////////
    13.  
    14.     internal static Type[] validPropTypes = {typeof(Vector3)};
    15.     internal static Type[] validValueTypes = {typeof(Vector3)};
    16.  
    17.     Vector3 typedStartVal;
    18.     Vector3 typedEndVal;
    19.     Vector3 changeVal;
    20.  
    21.     // GETS/SETS //////////////////////////////////////////////
    22.  
    23.     /// <summary>
    24.     /// Gets the untyped start value,
    25.     /// sets both the untyped and the typed start value.
    26.     /// </summary>
    27.     protected override object startVal
    28.     {
    29.       get
    30.       {
    31.         return _startVal;
    32.       }
    33.       set
    34.       {
    35.         if (tweenObj.isFrom  isRelative)
    36.         {
    37.           _startVal = typedStartVal = typedEndVal + (Vector3)value;
    38.         }
    39.         else
    40.         {
    41.           _startVal = typedStartVal = (Vector3)value;
    42.         }
    43.       }
    44.     }
    45.  
    46.     /// <summary>
    47.     /// Gets the untyped end value,
    48.     /// sets both the untyped and the typed end value.
    49.     /// </summary>
    50.     protected override object endVal
    51.     {
    52.       get
    53.       {
    54.         return _endVal;
    55.       }
    56.       set
    57.       {
    58.         _endVal = typedEndVal = (Vector3)value;
    59.       }
    60.     }
    61.  
    62.  
    63.     // ***********************************************************************************
    64.     // CONSTRUCTOR
    65.     // ***********************************************************************************
    66.  
    67.     /// <summary>
    68.     /// Creates a new instance of this plugin using the main ease type.
    69.     /// </summary>
    70.     /// <param name="p_endVal">
    71.     /// The <see cref="Vector3"/> value to tween to.
    72.     /// </param>
    73.     public PlugVector3Shake(Vector3 p_endVal)
    74.       : base(p_endVal, false) {}
    75.  
    76.     /// <summary>
    77.     /// Creates a new instance of this plugin.
    78.     /// </summary>
    79.     /// <param name="p_endVal">
    80.     /// The <see cref="Vector3"/> value to tween to.
    81.     /// </param>
    82.     /// <param name="p_easeType">
    83.     /// The <see cref="EaseType"/> to use.
    84.     /// </param>
    85.     public PlugVector3Shake(Vector3 p_endVal, EaseType p_easeType)
    86.       : base(p_endVal, p_easeType, false) {}
    87.  
    88.     /// <summary>
    89.     /// Creates a new instance of this plugin using the main ease type.
    90.     /// </summary>
    91.     /// <param name="p_endVal">
    92.     /// The <see cref="Vector3"/> value to tween to.
    93.     /// </param>
    94.     /// <param name="p_isRelative">
    95.     /// If <c>true</c>, the given end value is considered relative instead than absolute.
    96.     /// </param>
    97.     public PlugVector3Shake(Vector3 p_endVal, bool p_isRelative)
    98.       : base(p_endVal, p_isRelative) {}
    99.  
    100.     /// <summary>
    101.     /// Creates a new instance of this plugin.
    102.     /// </summary>
    103.     /// <param name="p_endVal">
    104.     /// The <see cref="Vector3"/> value to tween to.
    105.     /// </param>
    106.     /// <param name="p_easeType">
    107.     /// The <see cref="EaseType"/> to use.
    108.     /// </param>
    109.     /// <param name="p_isRelative">
    110.     /// If <c>true</c>, the given end value is considered relative instead than absolute.
    111.     /// </param>
    112.     public PlugVector3Shake(Vector3 p_endVal, EaseType p_easeType, bool p_isRelative)
    113.       : base(p_endVal, p_easeType, p_isRelative) {}
    114.  
    115.     /// <summary>
    116.     /// Creates a new instance of this plugin.
    117.     /// </summary>
    118.     /// <param name="p_endVal">
    119.     /// The <see cref="Vector3"/> value to tween to.
    120.     /// </param>
    121.     /// <param name="p_easeAnimCurve">
    122.     /// The <see cref="AnimationCurve"/> to use for easing.
    123.     /// </param>
    124.     /// <param name="p_isRelative">
    125.     /// If <c>true</c>, the given end value is considered relative instead than absolute.
    126.     /// </param>
    127.     public PlugVector3Shake(Vector3 p_endVal, AnimationCurve p_easeAnimCurve, bool p_isRelative)
    128.       : base(p_endVal, p_easeAnimCurve, p_isRelative) {}
    129.  
    130.     // ===================================================================================
    131.     // METHODS ---------------------------------------------------------------------------
    132.  
    133.     /// <summary>
    134.     /// Returns the speed-based duration based on the given speed x second.
    135.     /// </summary>
    136.     protected override float GetSpeedBasedDuration(float p_speed)
    137.     {
    138.       float speedDur = changeVal.magnitude/p_speed;
    139.       if (speedDur < 0)
    140.       {
    141.         speedDur = -speedDur;
    142.       }
    143.       return speedDur;
    144.     }
    145.  
    146.     /// <summary>
    147.     /// Sets the typed changeVal based on the current startVal and endVal.
    148.     /// </summary>
    149.     protected override void SetChangeVal()
    150.     {
    151.       if (isRelative  !tweenObj.isFrom)
    152.       {
    153.         changeVal = typedEndVal;
    154.       }
    155.       else
    156.       {
    157.         changeVal = new Vector3(typedEndVal.x - typedStartVal.x, typedEndVal.y - typedStartVal.y, typedEndVal.z - typedStartVal.z);
    158.       }
    159.     }
    160.  
    161.     /// <summary>
    162.     /// Sets the correct values in case of Incremental loop type.
    163.     /// </summary>
    164.     /// <param name="p_diffIncr">
    165.     /// The difference from the previous loop increment.
    166.     /// </param>
    167.     protected override void SetIncremental(int p_diffIncr)
    168.     {
    169.       typedStartVal += changeVal*p_diffIncr;
    170.     }
    171.  
    172.     /// <summary>
    173.     /// Updates the tween.
    174.     /// </summary>
    175.     /// <param name="p_totElapsed">
    176.     /// The total elapsed time since startup.
    177.     /// </param>
    178.     protected override void DoUpdate(float p_totElapsed)
    179.     {
    180.       float time = 1f - ease(p_totElapsed, 0f, 1f, _duration, tweenObj.easeOvershootOrAmplitude, tweenObj.easePeriod);
    181.  
    182.       SetValue(new Vector3(
    183.             typedStartVal.x + UnityEngine.Random.Range(-changeVal.x * time, changeVal.x * time),
    184.             typedStartVal.y + UnityEngine.Random.Range(-changeVal.y * time, changeVal.y * time),
    185.             typedStartVal.z + UnityEngine.Random.Range(-changeVal.z * time, changeVal.z * time)));
    186.     }
    187.   }
    188. }
    189.  
    I haven't tested it much, but here's how you can use it:

    Code (csharp):
    1.  
    2. // shake 5 units horizontally and 10 vertically
    3. Vector3 amount = new Vector3(5f, 10f, 0f);
    4. TweenParms parms = new TweenParms();
    5. PlugVector3Shake shake = new PlugVector3Shake(amount, EaseType.Linear, true);
    6. parms.NewProp("localPosition", shake);
    7. HOTween.To(transform, 0.5f, parms);
    8.  
    Happy coding.
     
  13. mrKaizen

    mrKaizen

    Joined:
    Feb 14, 2011
    Posts:
    139
    Ehi, SUPER COOL.
    Tks for sharing.. want to try it asap -_^
     
  14. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey imkira,

    thanks a lot for the contribution. When/if you think it's been tested enough, just tell me so I might add it inside the basic HOTween plugins :)
     
  15. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    What would the HoTween equivalent to this iTween code?


    Code (csharp):
    1. iTween.MoveBy(smokeCloud.gameObject, iTween.Hash("amount", amountVector, "time", 3.3, "easeType", iTween.EaseType.easeOutQuad));
    2.  
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hi renman3000. I just answered your private message, so I'll just post the same code here, but without the explanation :)

    Code (csharp):
    1.  
    2. HOTween.To(smokeCloud.transform, 3.3, "position", amountVector, true);
    3.  
     
  17. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hey izitmee,

    I'm trying to make a tween for a button pushing in, and then springing back when it is released. This is what i have so far, could you check it out? I'd just like to know if im doing something horribly wrong :)
    I thought maybe there might be a way to make the whole thing as one sequence but I wasn't sure how to approach it so i split it into two.

    Code (csharp):
    1. #pragma strict
    2.  
    3. import Holoville.HOTween;
    4. import Holoville.HOTween.Plugins;
    5.  
    6. var TestObj : GameObject;
    7. var TestObj2 : GameObject;
    8. var PushInSequence : Sequence;
    9. var PopOutSequence : Sequence;
    10.  
    11. function Start (){
    12.     ButtonPushIn();
    13.     ButtonPopOut();
    14. }
    15.  
    16. function Update () {
    17.     if(Input.GetKeyDown ("d"))TestButtonPushIn();//press
    18.     if(Input.GetKeyUp ("d"))TestButtonPopOut();//realease
    19. }
    20.  
    21.  
    22. //Create Button Sequence
    23. function ButtonPushIn (){
    24.     PushInSequence = new Sequence(new SequenceParms().Loops(1,LoopType.Restart).AutoKill(false));
    25.  
    26.     //Reset the position of the button
    27.     PushInSequence.Append(HOTween.To( TestObj.transform, 0, new TweenParms().Prop("position", new Vector3(0,0,0)) ));
    28.     //Animate the button's Position
    29.     PushInSequence.Append(HOTween.To( TestObj.transform,.5, new TweenParms().Prop("position", new Vector3(0,0,-2)).Ease(EaseType.EaseOutElastic) ));
    30. }
    31.  
    32. function ButtonPopOut (){
    33.     PopOutSequence = new Sequence(new SequenceParms().Loops(1,LoopType.Restart).AutoKill(false));
    34.  
    35.     //Reset the position of the button
    36.     PopOutSequence.Append(HOTween.To( TestObj.transform, 0, new TweenParms().Prop("position", new Vector3(0,0,-4)) ));
    37.     //Animate the button's Position
    38.     PopOutSequence.Append(HOTween.To( TestObj.transform,.5, new TweenParms().Prop("position", new Vector3(0,0,0)).Ease(EaseType.EaseOutElastic) ));
    39. }
    40.  
    41. function TestButtonPushIn(){
    42.     print ("On");
    43.     PushInSequence.Rewind();
    44.     PushInSequence.Play();
    45. }
    46.  
    47. function TestButtonPopOut(){
    48.     print ("Off");
    49.     PushInSequence.Complete(); 
    50.     PopOutSequence.Rewind();
    51.     PopOutSequence.Play();
    52. }
    Anyway, if you have a sec check it out.

    Thanks
    Pete
     
  18. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hi Pete :)

    Seems right to me, apart that you should add a
    Code (csharp):
    1.  
    2. PushOutSequence.Complete();
    3.  
    as the first line of TestButtonPushIn (as you did with PushInSequence and TestButtonPopOut).

    It could be done in a single sequence, playing it backwards when pushing in, and forward when pushing out, but the elastic ease would be inverted in one of the tweens, so this is probably better.
     
  19. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Ahh great, thanks!
    So, if you had a bunch of buttons would you create a sequence var for each of them and manage it that way?
    Just trying to figure out what parts I could re use to keep it as light as possible.
     
  20. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Yes, definitely. I actually made a library for 2D Toolkit to use sprites as buttons, and each button creates a sequence for each coupled animation (rollover-out, press-release, click).
     
  21. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Okay cool!,
    Hey, I hadn't heard of 2d toolkit, that looks great! Definitely checking that out!
    Thanks
    Pete
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Oh I'm absolutely in love with 2D Toolkit! Great package, great and very quick support, and constantly updated (and nope, I'm not affiliated with them: I'm just a fan ;)). I use it with all my 2D sprite-based games, and for the GUI of every game, 3D ones included.

    In case you get interested, here is a collection of open-source libraries I made for Unity, with the 2D Toolkit ones too (focused on easy-to-manage buttons for now). They're kind of undocumented for now, since they're still in pre-alpha.
     
  23. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Thanks man!, I'll check them out.
     
  24. therobear

    therobear

    Joined:
    Sep 28, 2010
    Posts:
    22
    Hello,

    I am not sure if this question has been asked before, but is it possible to dynamically change the speed the object is traveling on a path?

    BTW, I have been using HOTween for a project that I am working on and I think it\'s great!
     
  25. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hello therobear,

    yes you can change the speed of any tween dinamically, even while it plays. Just store a reference to your Tweener/Sequence, and then set the value of its timeScale property, like:
    Code (csharp):
    1.  
    2. myTween.timeScale = 2;
    3.  
     
  26. Deathvulture

    Deathvulture

    Joined:
    Nov 11, 2012
    Posts:
    2
    Hi, everyone, im new in this tween world. Is there a way to make a moving plattform push my character when it hit it? Thanks in advance.
     
    Last edited: Feb 9, 2013
  27. therobear

    therobear

    Joined:
    Sep 28, 2010
    Posts:
    22
    @Izitmee awesome! I'll try it out. thanks!
     
  28. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    Hi,

    First of all, thanks for a great Tween-solution. It's very nice indeed.

    I've been trying out a few Tweening solutions to try to get the functionality of a tween that represents a trajectory. I have a pre calculated path that i use for the tween and that works great. The problem however is that i can't find a way to get the speeds accurate to simulate a throw. The speed in X and Z directions needs to be constant, but the speed in the Y direction needs to start fast and then slow down until it's 0 and then start going downwards with increasing speed.
    Any idea how that can be accomplished?
     
  29. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @Deathvulture: you could use Unity's collision system to determine when your character is hit by the platform (or when it stands above it), and then create a tween to move it. But to be honest, your user case is not really suitable for a tween: much better to use some kind of custom (or non custom) physics to do that.

    @Enzign: I suppose you're using the PlugVector3Path... I'm not sure if this solution will work, but instead than a simple tween, you could try to create a Sequence which contains 2 tweens:
    - one with PlugVector3Path as usual, but lock the Y axis movement using the LockPosition method parameter
    - another with a simple Y tween, but using the PlugVectorY plugin (so X and Y values wouldn't be touched) and an easing of your choice
     
  30. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    Hi Izitmee,

    Thanks for the reply. It does seem like the only way to accomplish what i need is to use two tweens. I had to make a sequence of the Y-tween though, appending all the Y-coordinates to my sequence to get it to behave fairly realistic.

    Cheers!
     
  31. hafizmrozlan

    hafizmrozlan

    Joined:
    Jun 15, 2012
    Posts:
    117
    Hi, your tween library looks great and the cool website make me want to use it over other tween library. For this, I greatly appreciate your effort. Thank you.

    I'm not very experienced with tween and I haven't read all the documentation on the HOtween site but I have a little issue.

    I've set up a trigger collider so whenever my player hit it, it will return back to the top of the trigger that I want to collide with.

    When I use
    Code (csharp):
    1. if ( Input.GetKey (KeyCode.DownArrow) )
    2.             _playerTransform.Translate (Vector3.down * Time.deltaTime * 3);
    to move the player downward, once it touch the trigger then it'll moves back to the top as expected.

    But, when I use
    Code (csharp):
    1. if ( Input.GetKeyUp (KeyCode.DownArrow) )
    2.             HOTween.To (_playerTransform, 1, "position", new Vector3 ( _playerTransform.position.x, _playerTransform.position.y - 10 ) );
    it never return back to the top after touching the trigger.

    This is my trigger code
    Code (csharp):
    1. void OnTriggerEnter ( Collider other) {
    2.         if ( other = bottomLimit ) {
    3.             _playerTransform.position = new Vector3 ( _playerTransform.position.x, 2.0f );
    4.         }
    5.     }
    Does anyone knows what's wrong here?
     
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey hafizmrozlan,

    your code seems correct to me. Did you check if the content of your if-keyup is really called, by adding a debug log?

    On a side note, also consider that, if you just want to tween a single coordinate, you can directly use the PlugVectorX/Y/Z plugin to do it (wouldn't change anything anyway, so that's not part of the error).

    EDIT: though I see an error in your TriggerEnter code. You're writing
    Code (csharp):
    1.  
    2. if ( other = bottomLimit )
    3.  
    instead than
    Code (csharp):
    1.  
    2. if ( other == bottomLimit )
    3.  
     
  33. hafizmrozlan

    hafizmrozlan

    Joined:
    Jun 15, 2012
    Posts:
    117
    The KeyUp should be really called because the gameobject move and I can see a tweener was added to the hierarchy simultaneously.

    But I think maybe you're right, instead of using the equality operator I used the assignment one. What a silly mistake! Now it works just fine. Thanks for the help. And thank you also for reminding me about PlugVectorX/Y/Z.

    Have a nice day!
     
  34. S37H

    S37H

    Joined:
    Apr 1, 2012
    Posts:
    24
    Hotween is fantastic! Thank you so much for your efforts :)

    If it's not terribly difficult, it would be really helpful to have something similar to -OnComplete(sendMessageTarget, methodName, value) for OnStepComplete. It seems to only allow the other option - which appears to only pass basic variable types : int, vector3, float, etc - and doesn't seem to like it when I try to pass a gameObject or class through.

    I'm starting to look through some of the hotween scripts to see if I can rig it up myself but if you have suggestions or a solution that would be great! Thanks again!
     
  35. sirival

    sirival

    Joined:
    Sep 14, 2011
    Posts:
    146
    Is there a way to stop a tween without it calling its OnCompleted callback? Essentially cancel the tween and not call the callbacks?
     
  36. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hey Izitmee,
    Just having a little trouble setting up a tween for 2dToolkit. Can you see what I might be doing wrong with my sequence here? It doesnt seem to throw any error when I run the actual tween but nothing happens.

    Code (csharp):
    1. FadeOutSequence.Append(HOTween.To( SpriteScript.color,.5, new TweenParms().Prop("a",0).Ease(EaseType.EaseOutElastic) ));
    2.  
    Thanks
    Pete
     
  37. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @S37H: OnStepComplete accepts any object as additional parameters (I use it regularly with gameObjects and class instances), so maybe you're doing something wrong somewhere else? Anyway, adding a sendMessage overload is super-easy. Will do it within the weekend, when new HOTween update is coming.

    @sirival: OnComplete callback is called only if the tween completes (which can happen either if you let the tween play until the end, or if you force completion manually). If you pause a tween or kill it OnComplete won't be called:
    Code (csharp):
    1.  
    2. myTween.Pause();
    3. myTween.Kill();
    4.  
    @petey: you can't tween a single RGBA value of a color, since Colors are structs (when using JS they don't appear so, but in reality Unity is doing a background assignment of the full Color value). So you have to tween the whole Color, like this:
    Code (csharp):
    1.  
    2. var toColor:Color = mySprite.color;
    3. toColor.a = 0;
    4. FadeOutSequence.Append(HOTween.To(mySprite, .5, new TweenParms().Prop("color", toColor).Ease(EaseType.EaseOutElastic)));
    5.  
    EDIT: wrote wrong username :p
     
    Last edited: Feb 23, 2013
  38. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hey Izitmee ;)
    I was just wondering - I started a new project and noticed I now have TWO identical Hotween as packages by default in the project window. So I dig into the directory where Asset Store store the packages and found :

    .../ScriptingAnimation/Hotween.unitypackage
    .../Editor ExtensionVisual Scripting/Hotween.unitypackage


    I am wondering if I can delete one of them? Does this happen often? Did this happen when you moved the Hotween.unitypackage package to other section of the Asset Store?
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hi

    That's weird. In "ScriptingAnimation" it's correct to have the "HOTween.unitypackage" file, but inside the "Editor ExtensionsVisual Scripting" folder you should have a "HOTween Visual Editor.unitypackage" file instead (which contains the additional files for HOTween's Visual Editor). This is the first time I have this issue reported, and I have no idea what might've happened (and I always left HOTween in the same Asset Store section).

    Anyway, I'd suggest to delete the HOTween.unitypackage file that's inside the "Editor ExtensionsVisual Scripting" folder.
     
  40. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hey thanks Izitmee! Got it!
     
  41. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,418
    Heyho, is there PlayMaker-Support?

    Edit:

    And can i use the regular Version of iOS Development?

    Edit2:

    Are "Fade Ins/Outs" possible with HOTween?
     
    Last edited: Mar 7, 2013
  42. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey Mayhem,

    PlayMaker support was made by JeanFabre: you should check the playMaker forums about that.

    Not sure what you mean with using the regular version of iOS development. HOTween works with any platform (except Flash), but you'll need the micro version (which you can get from HOTween's website) if you use iOS Pro and max stripping level.

    I'm not sure what you mean with fade in/outs either. You can animate any property with easings etc, but if you mean camera fade ins/outs, there is no pre-made system since it's not the scope of HOTween (but you can easily make them) ;)
     
  43. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,418
    With regular iOS development i meant what you posted on your website, that one should use the HOTweenMicro Version instead.

    With Fade ins/outs i meant just manipulating the Alpha-Value of (for example) Sprites. But i already figured the stuff out, thank to your nice Visual Editor and the very nice workflow. Great tool!
     
  44. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hey Izitmee,
    I'm getting stumped on somthing that is probably pretty basic. Maybe you could point me in the right direction...

    This works fine for me -
    Code (csharp):
    1.     HOTween.To(GObject.transform, .5, "localPosition", Vector3(0,.22,0));
    But this doesn't -
    Code (csharp):
    1. HOTween.To(GObject.transform.localPosition, 1, "y", 12);
    What a i doing wrong in the second one??
    Thanks
    Pete
     
  45. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Oh, damn... That's the same as my last question isn't it :oops:
     
  46. 39thstreet

    39thstreet

    Joined:
    Jan 30, 2012
    Posts:
    104
    We're in the midst of trying to prep a port to Windows 8 and we're facing an issue because Win8 does not allow for the use of System.Reflection. Is there any workaround for that or are we out of luck?
     
  47. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Ouch sorry petey and 39thstreet. I received the notifications of your posts only now (Unity forums are getting crazier lately :/).

    @petey: glad you found the answer in the meantime ;)

    @39thstreet: woah I didn't know that: looks quite terrible. Sadly, I must say you're out of luck. I'm planning an alternative non-reflection system in HOTweenV2, but it's far to come (and will be also less easy to use, since Reflection is an otherwise fundamental base for reaching unknown properties).
     
  48. KyleStaves

    KyleStaves

    Joined:
    Nov 4, 2009
    Posts:
    821
    Isn't Unity itself heavily reliant on reflection? I'd imagine whatever happens in 4.2 to allow exporting to the Windows store must do something to make their mono implementation of reflection work, hopefully something we have access to ourselves.
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    I definitely hope so. Though their Flash implementation still doesn't support Reflection :/
     
  50. 39thstreet

    39thstreet

    Joined:
    Jan 30, 2012
    Posts:
    104
    Thanks for the reply.

    We've got a contact at Microsoft who is helping us with the port, and his explanation of the situation is that any use of System.Reflection prevents the app from passing certification. It still *works*, but they won't accept it in the store. Some kind of security concern I guess? I'm not really familiar with the platform. If you're curious, here's the full set of warnings from their verification service related to HOTween, looks like it's also not a fan of hashtables.