Search Unity

LeanTween - A tweening engine that is up to 5x faster than competing engines!

Discussion in 'Assets and Asset Store' started by dentedpixel, Dec 3, 2012.

  1. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Hi, how can i do this? Are you another parameter into the function?

    LeanTween.value(newBurst, "updateAlpha", 1f, 0f, 2f, _alphaPara);

    private void updateAlpha(GameObject go, float alpha)
    {
    go.GetComponent<tk2dSprite>().color = new Color(255, 255, 255, alpha);
    }
     
  2. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    You can, you would have to pass it in the "onUpdateParam" optional value , like this:

    PHP:
    LeanTween.value(newBurst"updateAlpha"1f0f2f, {"onUpdateParam":{"go":newBurst}});

    private 
    void updateAlpha(float alphaHashtable hash)
    {
    var 
    go:GameObject = (GameObject)hash["go"];
    go.GetComponent<tk2dSprite>().color = new Color(255255255alpha);
    }
     
  3. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Hi just beginning to code, i got abit of a problem i hope its my problem. i got this error.

    Failed to call function updateAlpha of class EffectManager
    Calling function updateAlpha with 1 parameter but the function requires 2.

    Code (csharp):
    1.  
    2.     private static Transform _transform;
    3.     private static Hashtable _alphaPara = new Hashtable();
    4.     private static Hashtable _objectPara = new Hashtable();
    5.    
    6.     // Use this for initialization
    7.     void Awake ()
    8.     {
    9.         _transform = transform;
    10.         _alphaPara.Add("onUpdateParam", _objectPara);
    11.     }
    12.    
    13.     public void Burst(Vector3 position)
    14.     {
    15.         GameObject newBurst = PoolManager.Create("Burst", _transform);
    16.         newBurst.transform.position = position;
    17.         _objectPara.Remove("gameObject");
    18.         _objectPara.Add("gameObject", newBurst);
    19.         _alphaPara.Remove("onUpdateTarget");
    20.         _alphaPara.Add("onUpdateTarget", gameObject);
    21.         LeanTween.value(newBurst, "updateAlpha", 1f, 0f, 1.5f, _alphaPara);
    22.     }
    23.    
    24.     private void updateAlpha(float alpha, Hashtable hashtable)
    25.     {
    26.         GameObject go = (GameObject)hashtable["gameObject"];
    27.         go.GetComponent<tk2dSprite>().color = new Color(255, 255, 255, alpha);
    28.     }
    29.  
    For your broadcastMessage you only pass in val, so where did onUpdateParam when? cause my code when into customTarget and there is no updateParam pass in. Sry i quite noob on coding...

    Code (csharp):
    1.  
    2.                     if(tween.optional!=null){
    3.                         var onUpdate = optionalItems["onUpdate"];
    4.                         if(onUpdate!=null){
    5.                             var updateParam:Hashtable = optionalItems["onUpdateParam"];
    6.                             if(onUpdate.GetType() == String){
    7.                                 var onUpdateS:String = onUpdate as String;
    8.                                 if (optionalItems["onUpdateTarget"]!=null){
    9.                                     customTarget = optionalItems["onUpdateTarget"];
    10.                                     customTarget.BroadcastMessage( onUpdateS, val );
    11.                                 }else{
    12.                                     trans.gameObject.BroadcastMessage( onUpdateS, val );
    13.                                 }
    14.                             }else{
    15.                                 var onUpdateF:Function = onUpdate as Function;
    16.                                 if(updateParam!=null) onUpdateF( val, updateParam );
    17.                                 else onUpdateF(val);
    18.                             }
    19.                         }
    20.                     }
    21.  
     
    Last edited: Aug 26, 2013
  4. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Woops, no you are quite right it looks like the C# version doesn't account for the onUpdateParam value, let me fix that and put up a new version on Github...
     
  5. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Tongie,

    I updated the version on Github, you will need to call the value function by passing the function directly instead of calling a string with the function name. I am in general trying to move away from calling the functions by using a string reference, as this is slower and more cumbersome. Here is an example of how you can call value with an onUpdataParam (there is an example also included in ExampleCSharp.cs on Github)

    PHP:
    Hashtable pass = new Hashtable();
    pass.Add("message""hi");
    LeanTween.valuegameObjectupdateValueExampleCallbackltLogo.transform.eulerAngles.y270f1f, new object[]{ "ease"LeanTweenType.easeOutElastic"onUpdateParam"pass });
     
  6. chris-lena

    chris-lena

    Joined:
    Aug 26, 2013
    Posts:
    3
    Hi there,
    where can I get LeanTween for UNITY 3.4 ?
     
  7. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Chris,
    You can download the latest from GitHub https://github.com/dentedpixel/LeanTween , the project files won't open in the Unity3.4 but the scripts should work just fine, just put the LeanTween.js file in your plugins folder and you should be good to go.
     
  8. chris-lena

    chris-lena

    Joined:
    Aug 26, 2013
    Posts:
    3
    Hi,
    thanks for the quick answer.
     
  9. chris-lena

    chris-lena

    Joined:
    Aug 26, 2013
    Posts:
    3
    Hi again, sorry
    are there a whole PDF for the documentation or must I go always look online?
     
  10. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    It's only online at the moment, I am planning on making a zipped version of it too, but I have not gotten to that yet, sorry :neutral:
     
  11. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Thanks its works now but i have another problem.

    I saw that you have this -> callback = optionalItems["onComplete"] as Function;

    but when I pass in destroy method rather than a string I have some error. How do I do this without using the string? i presumed string is slower. i wanna use a faster method because i have alot of object to handle.

    alphaParam.Add("onComplete", destroy); <-- No Problem
    alphaParam.Add("onComplete", destroy); <-- Got error

    Code (csharp):
    1.  
    2.                             if(optionalItems["onComplete"]!=null){
    3.                                 if(optionalItems["onComplete"].GetType()==String){
    4.                                     callbackS = optionalItems["onComplete"] as String;
    5.                                 }else{
    6.                                     callback = optionalItems["onComplete"] as Function;
    7.                                 }
    8.                             }
    9.  
     
  12. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Tongie,
    Sorry for the slow response, I was away on vacation. Unfortunately you are correct, you can only use a string for the onCompletes (with C#). I hope to have all the callback functions support non-string based solutions, but I haven't updated all of the code yet. Stay tuned, I will let you know when I have this in place.

    Thanks,
    Russ
     
  13. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    The free version is very generous of you. Would definitely buy the editor extension version if you can include Playmaker actions like iTween does.

    Thanks!
     
  14. Tongie

    Tongie

    Joined:
    Sep 19, 2012
    Posts:
    90
    Hi Dented, I doesnt know if your code is wrong or I m wrong with this? the LeanTween.Rotate doesnt work for me. How do i really use it?
    i wanna rotate it 0 to 359 degree but it goes the opposite direction when from 0->359=1degree(anti-clockwise) instead of 0->359=359degree(clockwise). Its rotate to its nearest direction instead of going always clockwise.

    Its all tween.from.x even its X or Y or Z?
    Code (csharp):
    1.  
    2.  
    3.                         case TweenAction.ROTATE_X:
    4.                             tween.from.x = trans.eulerAngles.x;
    5.                             tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x);
    6.                             break;
    7.                         case TweenAction.ROTATE_Y:
    8.                             tween.from.x = trans.eulerAngles.y;
    9.                             tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x);
    10.                             break;
    11.                         case TweenAction.ROTATE_Z:
    12.                             tween.from.x = trans.eulerAngles.z;
    13.                             tween.to.x = LeanTween.closestRot( tween.from.x, tween.to.x);
    14.                             break;
    15.  
    16. public static function rotateZ(gameObject:GameObject, to:float, time:float, optional:Hashtable):int{
    17.     return pushNewTween( gameObject, Vector3(to,0,0), time, TweenAction.ROTATE_Z, optional );
    18.  
    Thanks for the great Leantween its awesome pulgin...
     
  15. sobek

    sobek

    Joined:
    Jul 29, 2012
    Posts:
    44
    dentedpixel. LeanTween look awesome and exactly what i need, itween is to slow in project. Once i imported leantween into my project i got a couple of error messages for each example and menu script. That something named "LTRet" could not be found. I created a brand new project with no content and imported leantween, but i still get these error messages.

     
  16. Sajid_farooq

    Sajid_farooq

    Joined:
    May 23, 2012
    Posts:
    238
    Now that all of the "big 3" Tweening engines have been out there for quite a while, any recent rematches?

    I'm particularly interested in a comparison between this and Hotween.
     
  17. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hey,

    I'm using the c# version and I'm getting an error when I set a game object to SetActive(false);

    It seems LeanTween can't tell if the gameObject is null.

    Here is the error:

    so, I changed line 948 from:

    Code (csharp):
    1. else trans.gameObject.BroadcastMessage( callbackS, );
    to:

    Code (csharp):
    1. else trans.gameObject.BroadcastMessage( callbackS, SendMessageOptions.DontRequireReceiver);
    Everything seems to work.
    I don't know your code, so I hope this doesn't break anything else.
     
    Last edited: Sep 9, 2013
  18. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Sobek,
    You need to move LeanTween.js (or LeanTween.cs) into your Plugins folder (this is also explained in the Readme.txt). I had the same issues with speed, which is what motivated me to write LeanTween, I hope it will meet your needs!
     
  19. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Crazy Robot,

    I am not too keen on adding the dontrequirereceiver flag, because i am worried too many people will then have logic errors where there code is never called and they don't know why (keeping the calls being made forces users to realize that the callback is not on that object).

    However I think it would make sense to check if the object is active or not... maybe i can add in a case for that. I'll look into it, thanks!
     
  20. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Tongie,

    unfortunately you are right it just moves to the nearest value instead of a relative amount. I do have a new method

    rotateAround(gameObject:GameObject, point:Vector3, axis:Vector3, add:float, time:float, optional:Hashtable)

    that should be able to accomplish what you need. It is currently only in the version on GitHub but I plan to roll it out soon to the Asset Store version.

    I am glad you are enjoying LeanTween thanks for your support!
     
  21. tajny

    tajny

    Joined:
    Dec 28, 2012
    Posts:
    4
    Are there plans for catmull rom splines ? I must use other solution because of lack of this feature:/

    Anyway good job!
     
  22. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Thanks Tajny,
    I have thought of adding a catmull version of the bezier curve features, because sometimes you don't need the fine control you can get with bezier curves, and it is much easier to just add some points. So hopefully in the nearish future it will have that as well :)
     
  23. tajny

    tajny

    Joined:
    Dec 28, 2012
    Posts:
    4
    they are much better to control, and other tweening libs have it :D

    some of them (itween and hotween) use the same solution :

    http://forum.unity3d.com/viewtopic.php?p=218400#218400
    http://theinstructionlimit.com/flash-style-tweeneasing-functions-in-c
    http://whydoidoit.com/2012/04/06/unity-curved-path-following-with-easing/
     
  24. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    How to check if my gameObject currently have some LeanTween active on it?
     
  25. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Wagenheimer,
    You can call the method LeanTween.isTweening( gameObject ) , and that will tell you if the gameObject is being tweened at that time.

    Hope that helps
     
  26. dbanfield

    dbanfield

    Joined:
    Apr 20, 2013
    Posts:
    8
    Hi,
    I just started using leantween and it's pretty neat, very easy to set up and get tweening!

    However I'm hitting some problems with very simple setup. Sorry for the long post but it needs some explaining.

    All objects in a 2d setup i.e. freeze position and freeze rotation = true for everything except for XY position.

    a) Moving platform. Simple kinematic rigid body with the following script

    Code (csharp):
    1.   private Vector3 tweenPos;
    2.  
    3.   private void Start() {
    4.     Hashtable optional = new Hashtable();
    5.     optional.Add("ease", LeanTweenType.linear);
    6.     optional.Add("loopType", LeanTweenType.pingPong);
    7.     LeanTween.value(gameObject, UpdateTween, origin, destination, speed, optional);
    8.   }
    9.  
    10.   private void FixedUpdate() {
    11.     rigidbody.MovePosition (tweenPos);
    12.   }
    13.  
    14.   private void UpdateTween(Vector3 newValue) {
    15.     tweenPos = newValue;
    16.   }
    17.  
    Where origin and destination are inspector values. I'm moving the platform perfectly vertical by 6 units. This works fine, platform moves up and down. Notice I am using MovePosition and tweening an internal Vector since I want this to have physics execute on any physical objects in the environment.


    b) cube. Simple non-kinematic rigid body. Place cube on top of platform.

    Execute, and I'm observing the cube bouncing up and down slightly when the platform moves up and down.
    Hm. Weird.

    My question isn't the obvious one regarding the bouncing effects (I've been messing around with unity physics enough to know that the physics is a absolute PITA with little artefacts like this).

    The REAL problem that's bugging me is what happens when you don't use tweening to move the platform:

    Code (csharp):
    1.   private void FixedUpdate () {
    2.  
    3.     // Swap direction to simulate yoyo affect
    4.     if (Vector.approximately(rigidbody.position, destination)) {
    5.       Vector3 temp = destination;
    6.       destination = origin;
    7.       origin = temp;
    8.     }
    9.  
    10.     // Use MoveTowards instead of tweening
    11.     rigidbody.MovePosition (Vector3.MoveTowards (
    12.       rigidbody.position,
    13.       destination,
    14.       Time.fixedDeltaTime * speed));
    15.   }
    16.  
    I'm simply using the MoveTowards method, and suddenly we get a much smoother result as far as the physics goes. True the cube will bounce when the platform changes direction at the top, which is a much more expected realistic physical effect of inertia. However when the cube is on the platform, it sits there quite happily with no bouncing.

    I just cannot fathom why on earth these two methods produce such different results. All that both are doing is incrementing a Vector3 through a series of values and executing rigidbody.MovePosition in FixedUpdate.

    I've been driving myself mad now with this for a while so just had to reach out to see if anyone has any insights. Another thing to note is that HOTween results in similar strange behaviour when using a tweening approach.

    Thanks
    Dan
     
  27. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Dan,

    After giving it a lot of thought I think I have figured out what your problem is. The tweening engines do their updates on the Update loop, while your working physics example does the update of the value on the FixedUpdate loop. FixedUpdate often gets called many more times than the Update loop so you will have incremental changes that only work if you incremented in the FixedUpdate loop (so you will get jittery behavior since it does a lot of starting and stopping if you are just using a tweening engine that updates in the Update loop). The behavior probably looks like something like this:

    Update values when checked on FixedUpdate

    103.4
    103.4
    103.4
    106.7
    106.7
    109.3
    109.3
    109.3

    And when incremented in the FixedUpdate loop it is smooth

    103.4
    104.4
    105.4
    106.3
    etc


    Unfortunately I am not sure what can be done about this at the moment, LeanTween does not support physics or incrementing in the FixedUpdate loop. You could simply rename the Update function in LeanTween to FixedUpdate and that will make it update on the FixedUpdate loop, this will cause it to execute much more than necessary for non-physics animations, but it might be an acceptable solution.

    I hope to support physics in the future, but it requires a lot of reworking of the engine so it's going to take some time.

    I am glad you are liking LeanTween otherwise...

    Thanks,
    Russ
     
  28. dbanfield

    dbanfield

    Joined:
    Apr 20, 2013
    Posts:
    8
    Of course! Thanks so much for looking at this. I was sitting there thinking "I'm doing this in fixed update so how can it be wrong?" But of course that's not much use if LeanTween is only updating its values in Update ;)

    I gave your suggestion a quick test and it works great (also had to comment out if(frameRendered != Time.frameCount) in LeanTween.update()). As you say it's not perfect, but I will simply have a LeanTweenFixed duplicate class vs LeanTween if I have a need to mix-and-match. I can deal with the extra 100kb file size overhead... Since my game is mostly physics-based though I shouldn't think it will be a problem to just tween everything as fixed.

    Looking forward to full physics support!
     
  29. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    Hi,

    I'm trying LeanTween, many thanks for it! I'm trying to use it to move the enemies in my game along paths but it seems I don't fully understand the way the curves are implemented in LeanTween.

    Checking the documentation of LeanTween.move, I find this:

    path:Vector3[] A set of points that define the curve(s) ex: Point1,Handle1,Handle2,Point2,...

    I'm tryng to have my enemies follow a simple semicircle in the X,Z plane (the Y axis is fixed). If I'm not mistaken, I should pass the first point of the semicircle and the last point as Point1 and Point2. However, for the Handles I don't manage to find a combination that gives me a proper curve (semicircle curve).

    This is my code in case it helps:

    Code (csharp):
    1.  
    2.     public Vector3[] path;
    3.     public float time=2;
    4.     public bool orient = false;
    5.    
    6.    
    7.     public void Start()
    8.     {
    9.        
    10.         for (int i = 0; i < path.Length; i++)
    11.         {
    12.             path[i] = new Vector3(transform.position.x + path[i].x, transform.position.y + path[i].y, transform.position.z + path[i].z);
    13.         }
    14.  
    15.         Hashtable optional = new Hashtable();
    16.         optional.Add("ease",LeanTweenType.easeOutQuad);
    17.         optional.Add("orientToPath",orient);
    18.         optional.Add("repeat", -1);
    19.         optional.Add("loopType", LeanTweenType.pingPong);
    20.         LeanTween.move(gameObject, path, time, optional);
    21.  
    22.     }
    The closest I get to what I'm trying to achive is when I use for the path [(0,0,0),(100,0,0),(0,0,0),(0,0,-100)]. But it is not perfect and moreover I don't understand why it gives me a shape similar (but not quite ther to) what I want. I have been working under the assumption of the following picture:

    $html5-canvas-bezier-curves-diagram.png

    Under this assumption I would expect that to get something similar to a semicircle I should pass a path like [(0,0,0),(100,0,0),(100,0,-100),(0,0,-100)]. But this gives me terrible results

    Any help?

    BTW, I'm using the latest c# version from GitHub.
     
  30. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Stilghar,

    What's kind of annoying about bezier curves is you need a couple in order to get something that resembles a true circle (usually 8 paths for a whole circle, so you would need 4 for a semi-circle). Here is an example of a semi-circle I made with the LeanTween Editor (it is really the easiest way to make paths when you are doing anything sort of complicated).

    var halfCircle:Vector3[] = [new Vector3(26.2, -6.7, 66.4),new Vector3(24.0, -6.7, 78.9),new Vector3(26.1, -6.7, 73.6),new Vector3(18.9, -6.7, 84.0),new Vector3(18.9, -6.7, 84.0),new Vector3(8.4, -6.7, 91.3),new Vector3(13.7, -6.7, 89.1),new Vector3(1.2, -6.7, 91.4),new Vector3(1.2, -6.7, 91.4),new Vector3(-11.3, -6.7, 89.1),new Vector3(-6.1, -6.7, 91.3),new Vector3(-16.5, -6.7, 84.0),new Vector3(-16.5, -6.7, 84.0),new Vector3(-23.8, -6.7, 73.6),new Vector3(-21.6, -6.7, 78.9),new Vector3(-23.8, -6.7, 66.4)];
     
  31. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    Thanks for the example!

    I was already considering buying the visual editor, I lost track of all the comments on the thread. Is it already written in c# or at least compatible with c#? What are your plans in that respect now, are you going for c# as the main language of LeanTween and the editor or it will be Javascript and the c# versions will get updated from time to time?


    BTW, did you finally implemented moveLocalCurve? I don't find it...
     
  32. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    It is compatible with C# both in it's current form and there is also a zipped up C# version.

    Right now I am going in the direction of just writing everything twice, once in JS and again in C#, it's not ideal, but i think there are advantages to having both in their native languages.

    Yup! the LeanTween.moveLocal function works fine for curved paths. I need to get to updating the documentation...
     
  33. ChristofS

    ChristofS

    Joined:
    Jan 22, 2013
    Posts:
    9
    Hi,

    I stumbled upon LeanTween and I like it. It is a fast and easy to use solution.

    To simplify the integration into my application I wrote a small C# module to create the parameter hashtable in an easy and typesafe manner.

    The class "LeanTweenHashtable" has a floating interface so you can write for example:

    Code (csharp):
    1.  
    2. Hashtable args = new LeanTweenHashtable()
    3.           .SetEase(LeanTweenType.easeInElastic)
    4.           .UseEstimateTime()
    5.           .SetNumRepeats(2)
    6.           .SetLoopType(LeanTweenType.pingPong)
    7.           .Hashtable;
    8.  
    Perhaps this is useful for someone.

    Christof
     

    Attached Files:

  34. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Chris, thanks for sharing this. I had been thinking about a similar type of type-safe way to pass optional params, but it was slightly different. I like your solution better, it has inspired me to build something similar into LeanTween for a future release...

    One question, what is the formatting you are using for your comments? Is that a Visual Basic formatting (for autocompletion)? Just curious, as I am always looking to have my comments in the most useful format for everyone...

    Cheers,
    Russ
     
    Last edited: Oct 24, 2013
  35. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Hi,

    following up on the bezier, I believe there is something strange here when passing a Vector3[] to the move tween. A square (P1, C1, C2, P2) -- P1 lower left, then clockwise -- should give something approx to a half circle or a half sine curve. Instead, you get a twisted loop. However if you exchange the control handles (P1, C2, C1, P2), you get exactly that expected clean curve. Could there be some bug still in the LeanTween bezier piece?

    Regards, habitoti
     
  36. ClockworkWolf

    ClockworkWolf

    Joined:
    Sep 12, 2013
    Posts:
    55
    Hi dentedpixel,
    I just got the updated version today, and it seems that the LeanTween.cs file is not in the unity package?
     
  37. ChristofS

    ChristofS

    Joined:
    Jan 22, 2013
    Posts:
    9
    Hey Russ,

    the formatting is a mixture of the standard C# formatting (the special tags <summary>, <remarks>,...) which Visual Studio uses for autocompletition and some additions I made, to make it more readable and give my code a better structure. But the second is a matter of taste.

    If you insert /// in Visual Studio above of a method, member,..., Visual Studio inserts the comment tags automatically.


    Code (csharp):
    1.    
    2. // This comment is what Visual Studio does for you automatically. These infos are used for autocompletition.
    3. // There are free tools which could create a complete library documentation out of this infos.
    4.  
    5.  /// <summary>
    6.  ///
    7.  /// </summary>
    8.  /// <param name="delayedCallback"></param>
    9.  /// <returns></returns>
    10.  public LeanTweenHashtable AddOnCompleteCallback(string delayedCallback)
    11.  {
    12.  }
    13.  
    To create my special form of comment, I wrote a small Visual Studio macro which does it for me.

    Christof
     
  38. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Ack! How on earth did that happen? Neither the LeanTween.js file or the LeanTween.cs file are there...

    Thank you for alerting me to this, something must have gone wrong in the submission process. I will try and get the real version up there ASAP.

    For the time being you can get the latest on Github: https://github.com/dentedpixel/LeanTween
     
  39. ClockworkWolf

    ClockworkWolf

    Joined:
    Sep 12, 2013
    Posts:
    55
    No worries mate, glad to help!

    Also, thank you very much for developing this package. I'll be sure to drop a token of appreciation in your tip jar :)

    Cheers!
     
  40. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Hi dentedpixel, can you quickly also comment on my post a bit above? I am really struggling with this one...Maybe I simply understood it all wrong, but it feels like being wrong implementation-wise...
     
  41. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Thanks for your donation! It is very much appreciated :)
     
  42. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Habitoti,
    I am looking into your question now. I am worried you may be correct, those values are flipped (my bad!). Unfortunately I don't think I can just flip them back the other way, as this will break anybody else's implementation that are already using the paths in this form. However at least I could update the documentation if this is the case...
     
  43. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    I am actually fine if it's just twisted and stays that way ;-) I just want to avoid to program along that and then later on have to change it everywhere -- or worse: forget some places then.
    The good thing is: seems I understood Beziers correctly ;-)
     
  44. Darkmoon

    Darkmoon

    Joined:
    Nov 23, 2012
    Posts:
    28
    Is it me, or is the actual LeanTween.cs file missing from the distribution on the Asset store now? I don't see the PLugin folder at all any longer? I also don't see it for download on the Dented Pixel website.
     
  45. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    No, it is not only you, I unfortunately submitted a version without the LeanTween file included! I know pretty dumb, I am not sure how it passed the approval process. I have submitted a new build, and tried to get them to expedite it, but it may be a couple of days before they approve the fixed version.

    In the meantime, you can get the latest on Github: https://github.com/dentedpixel/LeanTween
     
  46. Darkmoon

    Darkmoon

    Joined:
    Nov 23, 2012
    Posts:
    28
    Awesome! Thanks!

    As an aside... it looks like "LeanTween.moveLocalX" has two overloads, both with a third parameter called "optional". You can no longer pass in "null" as the third parameter because that makes the call "ambiguous" as to which version of the overload you're calling. Therefore, you have pass in an object as the third parameter, and it's no longer optional as the parameter name suggests.

    For my purposes, I added a check to pushNewTween that says

    if(optional.Count < 1)
    {
    optional = null;
    }

    That way, I can pass in a new HashTable without values and it works like before.
     
  47. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    You can just cast null to the signature you want. If you use (Hashtable) null as third parameter, then you get exactly the right signature.

    Beyond that, I personally don't like that parameter naming at all, since optional has already another semantic in C#, and so you can get easily confused. Best would have been to call it e.g. additionalParams and then really make it optional with a default value of null.

    Regards, habitoti
     
  48. Darkmoon

    Darkmoon

    Joined:
    Nov 23, 2012
    Posts:
    28
    Learn something new every day! I've been writing C# code for over 10 years... and have never cast null to anything before, and frankly never thought there would be reason to do so.

    Thanks for that!
     
  49. Ghisallo

    Ghisallo

    Joined:
    Sep 27, 2012
    Posts:
    10
    The latest version of LeanTween doesn't appear to be compatible with Flash builds. I know Flash isn't officially supported anymore, but some of us still need it. In any case, here's the error. Thanks!

    Code (csharp):
    1. Error building Player: Exception: java Failed:
    2. Loading configuration file C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\flashsupport\BuildTools\flex\frameworks\flex-config.xml
    3.  
    4. C:\Maya\projects\clients\DeFeet\Unity\DeFeet Viewer\Temp\StagingArea\Data\ConvertedDotNetCode\global\LeanTween.as(842): col: 27 Error: Call to a possibly undefined method op_Inequality through a reference with static type Class.
    5.  
    6.                                                     if (Function.op_Inequality($action4, null)) {
    7.                                                                  ^
    8.  
    9. C:\Maya\projects\clients\DeFeet\Unity\DeFeet Viewer\Temp\StagingArea\Data\ConvertedDotNetCode\global\LeanTween.as(2152): col: 24 Error: Call to a possibly undefined method RuntimeServices_op_Equality_CLIArray_CLIArray through a reference with static type Class.
    10.  
    11.             if (RuntimeServices.RuntimeServices_op_Equality_CLIArray_CLIArray(LeanTween$eventListeners$, null)) {
    ^
     
  50. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Ghisallo,

    Thanks for letting me know, I wasn't really aware anybody was using the Flash compatibility anymore. I will look into the error, is this with Unity 3.5 or Unity 4.x?
     
    Last edited: Nov 6, 2013