Search Unity

DOTween (HOTween v2), a Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Aug 5, 2014.

  1. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW UPDATE 0.9.020
    • NEW: Added axisConstraint parameter to DOLookAt methods
    • NEW: Added Image.DOColor/DOFade shortcuts (Unity 4.6)
    • NEW: Added CanvasGroup.DOFade shortcut (Unity 4.6)
    • NEW: Added DOTween46 DLL with specific Unity 4.6 (new UI) shortcuts
    • NEW: Added DOTween.Validate method to manually parse all tweens and remove the ones who have become invalid (usually because their target became null)
    • NEW: If safe mode is ON, each time a scene is loaded all tweens are validated so that even non-playing ones will be removed if invalid
    • Added default values in XML comments for main DOTween static properties
    • BUGFIX: Fixed deeply nested Sequence callbacks not firing correctly
    Since this update introduces shortcuts for the new 4.6 UI, simply delete the DOTween46 files if you're on an older Unity version and you're done.


    @Seith Here you go: Image shortcuts :) By the way, I'm still not using the new UI, so if you (or someone else) think of other shortcuts that might be useful let me know and I'll implement them.

    @neonblitzer @OnePxl After more ponderous thoughts, I decided not to touch PlayBackwards. Since the matter is English/US I decided I'll take a stance like Unity did with MonoBehaviour/MonoBehavior and mix languages: so PlayForward and PlayBackwards :p
     
    Last edited: Sep 29, 2014
    rakkarage likes this.
  2. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Hello Izitmee,

    Again a question;

    Is it possible to get the duration in time, even when SpeedBased = true and including loops, easing etc.?

    Tnx in advance,
    Greetz,
    G
     
  3. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hi @gpvd, sure you can get the duration, even when speedBased: just use myTween.Duration(includeLoops). Consider though that, in case of speedbased tweens, the real duration will be returned only after the tween has started (since that's when the conversion to a speedbased duration is calculated).
     
  4. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Thank you very much!
     
  5. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    That's great! Thank you very much Izitmee! :)

    Actually there IS one shortcut with regards to the new uGUI in 4.6: the visibility of UI elements within a panel is controlled by a component called .<CanvasGroup>(). Having a shortcut to tween its alpha would be extremely useful. Right now I have to do:

    Code (CSharp):
    1. DOTween.To(()=> feedbackCanvasGrp.alpha, x=> feedbackCanvasGrp.alpha = x, 0f, .2f);
    But being able to do this would be much cleaner:

    Code (CSharp):
    1. feedbackCanvasGrp.DOFade(0f, .2f);
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
  7. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Ooooh very nice! Thank you so much! :) Downloading right now...
     
  8. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    By the way Izitmee where can I find a list of available ease in/out options for DOTween (with hopefully some kind of visual indication of what they mean)?
     
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Uh you're right: I always assume that ease curves are logical but they're actually not. I'll create a visualizer, but since they're all the same for all tween engines on all platforms (because ease algorithms were created by the masterful Robert Penner and everybody implements those) in the meantime you can check their visualizations here.
     
    Last edited: Sep 29, 2014
  10. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Ah wonderful, thank you! :)
     
  11. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    Just wanted to confirm that it works fine for me in the sample project :)
     
  12. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Great :)

    P.S. did you just change your account? the new Unity forum ate your previous one (I heard that happens, agh!)?
     
  13. macshemp

    macshemp

    Joined:
    Sep 24, 2014
    Posts:
    2
    Hi sorry if this is a stupid/basic question but I'm trying to get my head round C# after many years of Actionscript, javascript and Greensocks Tweenmax.

    So far it is all going well and I'm finding your tweening engine is doing everything I could want of it, so hurrah.

    My question is can you send parameters with OnComplete, OnUpdate etc, or is this impossible as you wouldn't know what types were being sent.
     
  14. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @macshemp not a stupid question at all, and I'll have to add info about that on the documentation. You can pass all the parameters you want, thanks to the everloving lambdas.

    For example. If you want to call a function with no parameters you just do this, as you already know:
    Code (csharp):
    1. .OnComplete(MyFunction)

    If instead your function requires parameters, say hello to lambdas.
    For example, if you want to call this function which requires 2 ints as parameters...
    Code (csharp):
    1. MyFunctionWithParameters(int firstInt, int secondInt)
    2. {
    3.    // Do something blahblah
    4. }
    ...you do like this...
    Code (csharp):
    1. .OnComplete(()=> MyFunctionWithParameters(2,3))
     
    FaberVi likes this.
  15. macshemp

    macshemp

    Joined:
    Sep 24, 2014
    Posts:
    2
    Thanks for the quick reply I need to get into these lambdas in a big way they look very cool.

    Cheers

    PS just tried it and it works! Perfect
     
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Lambdas are awesome, I definitely recommend getting comfy with them for regular development. In short they're used to create anonymous functions, but in a much less verbose way than in ActionScript (I arrived to Unity after many years of AS and TweenMax too).
     
  17. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Ricks By the way, I forgot to mention you in the update post. Latest update 0.9.020 adds axisConstraint parameter to DOLookAt, both for Transforms and Rigidbodies ;)
     
    Ricks likes this.
  18. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    @Izitmee Not actually, i had joined indie gamedev company, so they put out a gun and forced me to create a new account :)
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Sooo, I decided that the path plugin will be in the free DOTween version, while the Pro will have a path editor.

    So, here's a teaser of the new path plugin (coming in the next update):

    dotween_path_teaser.gif
     
    rakkarage likes this.
  20. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Uh. Nice. When do you think will the Pro Version come out?
     
  21. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    I just spent a lot of time reworking some internal Sequence architecture (delivered in the last update), so I dropped behind on Pro release. The Pro path editor is kind of a fight to workaround some Unity editor bugs in order to achieve what I have in mind, so I'm not sure when I'll be done.
    The basic version with path tweening instead will be out within the weekend :) But! It will be a heavy alpha version of the path plugin. Mostly it's all done, but there might be use cases where bugs might appear where I'll need some users feedback to find them.
     
  22. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    P.S. here's a screenshot of the current state of the visual path editor, linear version (still, it will be just a per-object editor, so as usual I have to say that @Baroni's SWS — which will soon upgrade to DOTween — will remain the preferred way for serious path management)

    2014-10-02 14_56_45-Unity - Paths.unity - UnityTests.Unity4 - PC, Mac & Linux Standalone_.png
     
    Baroni likes this.
  23. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Hi Izitmee, I am confronted with a very strange (at least to me) behavior when using DORotate. Documentation says: "Rotates the target to the given value". But when I do a:

    Code (CSharp):
    1. playerTransform.DORotate(new Vector3(0f, 45f, 0f), .15f);
    Then my player transform just spins on itself in a loop. The behavior I was expecting is for the player transform to rotate until it reaches the end value stated in the Vector3. Not a looping rotation. I also tried DOLocalRotate but the result is the same...

    What am I doing wrong here?

    Update:
    I also tried using a DOLookAt instead, like so:

    Code (CSharp):
    1. playerTransform.DOLookAt(contactPoint, .15f, AxisConstraint.Z, Vector3.up);
    But that doesn't work either: sometimes the character points in the correct direction, sometimes it points at 90deg (either left or right) from the desired direction.

    (Just to be clear: in that case I want the character's forward direction (+Z) to point towards the contactPoint. Meaning that the rotation should happen on the Y axis while leaving X and Z at zero)
     
    Last edited: Oct 2, 2014
  24. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Seith That is indeed very strange. I tried to replicate it but everything works perfectly here (and your code is correct). Are you sure there are no other tweens/animations affecting that same transform? Otherwise, can you whip up a quick test project that replicates the issue and attach it here, so I can check it out?
     
  25. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    I did check that and no other tween or animation is affecting the transform.

    (I just sent you a PM)
     
  26. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @Izitmee Do you think you could add a shortcut for a light's shadowStrength please? I mean the same way you already have one for a light's intensity. If that's not too much of a problem of course...

    Update:
    Well, I guess I could always do:

    Code (CSharp):
    1. DOTween.To(()=> sunLight.shadowStrength, x=> sunLight.shadowStrength = x, newShadowStrength, transitionTime);
     
    Last edited: Oct 5, 2014
  27. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Seith You caught me just in time: I was just releasing the new version. I'll add it immediately before release (shortcuts like those are super-quick and easy to implement, so no problem at all) :)
     
  28. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW UPDATE 0.9.120
    • NEW: Path plugin (transform.DOPath) added to basic DOTween version (still very alpha)
    • NEW: Added DOTween Setup menu item to setup additional shortcuts if the current Unity version is high enough
    • NEW: Added light.DOShadowStrength
    • BUGFIX: Added check to take care of DOTween instances being left around from runtime in case of rare Unity freezes
    • BUGFIX: Fixed DOLookAt not working correctly with axis constraints
    IMPORTANT: from now on, instead than deleting DOTween43/46 if you're on older Unity versions, you simply have to select the DOTween Setup menu item each time you update DOTween, and everything will be taken care and imported automatically. Don't forget to run it, or you won't upgrade/import the Unity 4.3/4.6 additional shortcuts (or auto-delete them in case you're on older versions).

    dotween_setup.png
     
    Last edited: Oct 5, 2014
    YaVeTaL likes this.
  29. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Thank you @Izitmee ! :)

    I have a question regarding OnUpdate() and OnComplete(): is it possible to pass an argument to those? So I could do something like:

    Code (CSharp):
    1. myTransform.DORotate(Vector3.one, 2f).OnComplete(myMethod(myArgument));
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
  31. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Oh I see, thank you!
     
  32. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    First time I realize that posts have numbers :D
     
  33. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW MINOR UPDATE 0.9.130 (merged with previous update 0.9.120)
    • NEW: Added SetOptions and SetLookAt settings for path tweens (still very alpha)
    • NEW: Added full XML and website documentation for path plugin and settings
    New from 0.9.120
    • NEW: Path plugin (transform.DOPath) added to basic DOTween version (still very alpha)
    • NEW: Added DOTween Setup menu item to setup additional shortcuts if the current Unity version is high enough
    • NEW: Added light.DOShadowStrength
    • BUGFIX: Added check to take care of DOTween instances being left around from runtime in case of rare Unity freezes
    • BUGFIX: Fixed DOLookAt not working correctly with axis constraints
    IMPORTANT: from now on, instead than deleting DOTween43/46 if you're on older Unity versions, you simply have to select the DOTween Setup menu item each time you update DOTween, and everything will be taken care and imported automatically. Don't forget to run it, or you won't upgrade/import the Unity 4.3/4.6 additional shortcuts (or auto-delete them in case you're on older versions).

     
  34. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    Hi i am trying to get a sequence to run like so

    object shakes a little->slight delay->rotates a little-slight delay->the object moves to the center and scales up at the same time->delay->object rotates back to normal

    It works however it looks quite messy, if you wish to create a delay in the sequence do you have to use appendInterval along with insert? if so the amount of magic numbers you use is quite abysmal.

    So is this right? or is there a cleaner or nicer looking way to achieve what i have just done ? here is the code

    Code (CSharp):
    1.  
    2. SequencemySequence = DOTween.Sequence();
    3. mySequence
    4.  .Append(cardAffectedCopy.transform.DOShakePosition(1,5,20,90,false))
    5.  .AppendInterval(0.6f)
    6.  .Insert(1+0.6f,cardAffectedCopy.transform.DOLocalRotate(newVector3(0,0,-15),0.3f,false)).SetEase(Ease.InOutElastic)
    7.  .AppendInterval(2)
    8.  .Insert(1+0.6f+2,cardAffectedCopy.transform.DOMove(Vector3.zero,0.6f,false)).SetEase(Ease.OutBounce)
    9.  .Insert(1+0.6f+2,cardAffectedCopy.transform.DOScale(newVector3(1.5f,1.5f,1.5f),0.6f).SetEase(Ease.OutBounce))
    10.  .AppendInterval(1)
    11.  .Insert(1+0.6f+2+1,cardAffectedCopy.transform.DOLocalRotate(Vector3.zero,0.5f,true)).OnComplete(()=>TweenComplete(5));
    12.  
     
  35. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Nemial You can remove the AppendInterval methods. If you Insert a tween with an "insertion time" that is longer than the current Sequence duration, an interval will be automatically added. Like this:
    Code (CSharp):
    1. SequencemySequence = DOTween.Sequence();
    2. mySequence
    3. .Append(cardAffectedCopy.transform.DOShakePosition(1,5,20,90,false))
    4. .Insert(1+0.6f,cardAffectedCopy.transform.DOLocalRotate(newVector3(0,0,-15),0.3f,false)).SetEase(Ease.InOutElastic)
    5. .Insert(1+0.6f+2,cardAffectedCopy.transform.DOMove(Vector3.zero,0.6f,false)).SetEase(Ease.OutBounce)
    6. .Insert(1+0.6f+2,cardAffectedCopy.transform.DOScale(newVector3(1.5f,1.5f,1.5f),0.6f).SetEase(Ease.OutBounce))
    7. .Insert(1+0.6f+2+1,cardAffectedCopy.transform.DOLocalRotate(Vector3.zero,0.5f,true)).OnComplete(()=>TweenComplete(5));
    Or even better you could leave the intervals and replace all Insert with Append (except the DOScale one since you want it to run in parallel with the previous one), since Append automatically adds tweens to the current end time of the Sequence:
    Code (CSharp):
    1. SequencemySequence = DOTween.Sequence();
    2. mySequence
    3. .Append(cardAffectedCopy.transform.DOShakePosition(1,5,20,90,false))
    4. .AppendInterval(0.6f)
    5. .Append(cardAffectedCopy.transform.DOLocalRotate(newVector3(0,0,-15),0.3f,false)).SetEase(Ease.InOutElastic)
    6. .AppendInterval(2)
    7. .Append(cardAffectedCopy.transform.DOMove(Vector3.zero,0.6f,false)).SetEase(Ease.OutBounce)
    8. .Insert(3.6f,cardAffectedCopy.transform.DOScale(newVector3(1.5f,1.5f,1.5f),0.6f).SetEase(Ease.OutBounce))
    9. .AppendInterval(1)
    10. .Append(cardAffectedCopy.transform.DOLocalRotate(Vector3.zero,0.5f,true)).OnComplete(()=>TweenComplete(5));
     
    Nemial and YaVeTaL like this.
  36. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    Wow, that's really useful. I think you have to add it to manual or FAQ.
     
  37. Nemial

    Nemial

    Joined:
    Feb 25, 2014
    Posts:
    16
    That is fantastic stuff, thanks, works as advertised, however if you could just clarify another thing for me, how would i go about playing certain tweens in a sequence in reverse? So in the code i posted earlier let's say i keep a reference to some of the tweens and then want to play them in reverse in a sequence?

    this is what i am about to test now, i suspect it to not work in some fashion.

    Code (CSharp):
    1.  
    2. public void RevealCard( WCBattleCard card )
    3. {
    4.     card.gameObject.SetActive(false);
    5.     GameObject cardAffectedCopy = card.createDisplayCopy();
    6.     WCBattleCard bCard = cardAffectedCopy.GetComponent<WCBattleCard>();
    7.     bCard.ShutCard(0);
    8.  
    9.     Tweener a = cardAffectedCopy.transform.DOShakePosition(1,5,20,90,false);
    10.     Tweener b = cardAffectedCopy.transform.DOLocalRotate(new Vector3(0,0,-15),0.3f,false);
    11.     Tweener c = cardAffectedCopy.transform.DOMove(Vector3.zero,0.6f,false);
    12.     Tweener d = cardAffectedCopy.transform.DOScale(new Vector3(1.5f,1.5f,1.5f),0.7f);
    13.     Tweener e = cardAffectedCopy.transform.DOLocalRotate(Vector3.zero,0.5f,true);
    14.  
    15.     List<Tweener> tweens = new List<Tweener>(){c,d};
    16.  
    17.     Sequence mySequence = DOTween.Sequence();
    18.     mySequence
    19.         .Append(a)
    20.         .AppendInterval(0.6f)
    21.         .Append(b).SetEase(Ease.InOutElastic)
    22.         .AppendInterval(2)
    23.         .Append(c).SetEase(Ease.OutBounce)
    24.         .Insert(3.9f,d).SetEase(Ease.OutBounce)
    25.         .AppendInterval(1)
    26.         .Append(e)
    27.         .AppendInterval(1)
    28.         .OnComplete(()=>TweenComplete(bCard,tweens));
    29. }
    30.  
    31. void TweenComplete(WCBattleCard battleCardCopy, List<Tweener> tweens)
    32. {
    33.     GameObject trapCopy = createDisplayCopy();
    34.     WCTrapCard tCardCopy = trapCopy.GetComponent<WCTrapCard>();
    35.     tCardCopy.ShutCard(0);
    36.  
    37.     tCardCopy.transform.localPosition = battleCardCopy.transform.localPosition;
    38.     tCardCopy.SetCardsDepth(battleCardCopy.LowestDepth()-1);
    39.     tCardCopy.transform.localScale = new Vector3(1.5f,1.5f,1.5f);
    40.  
    41.     Tweener a = battleCardCopy.transform.DOLocalMoveX(battleCardCopy.transform.localPosition.x+160,1,true);
    42.     Tweener b = trapCopy.transform.DOLocalMoveX(battleCardCopy.transform.localPosition.x-160,1,true);
    43.  
    44.     tweens.Add(b);
    45.     tweens.Add(a);
    46.  
    47.     Sequence mySequence = DOTween.Sequence();
    48.     mySequence
    49.         .Append(a).SetEase(Ease.InOutBounce)
    50.         .Insert(0,b).SetEase(Ease.InOutBounce)
    51.         .Append(battleCardCopy.OpenCard())
    52.         .Append(tCardCopy.OpenCard())
    53.         .AppendInterval(2)
    54.         .OnComplete(()=> EffectPreviewStart(battleCardCopy,tCardCopy,tweens));
    55. }
    56.  
    57. void EffectPreviewStart(WCBattleCard battleCardCopy,WCTrapCard trapCardCopy,List<Tweener> tweens)
    58. {
    59.     Debug.Log("EffectPreviewStart called");
    60.     //TODO call effect preview here
    61.     EffectPreviewFinished(battleCardCopy,trapCardCopy,tweens);
    62. }
    63.  
    64. void EffectPreviewFinished(WCBattleCard battleCardCopy,WCTrapCard trapCardCopy,List<Tweener> tweens)
    65. {
    66.     foreach(Tweener tween in tweens)
    67.     {
    68.         tween.isBackwards = true;
    69.     }
    70.  
    71.     Debug.Log("EffectPreviewFinished called");
    72.     Sequence mySequence = DOTween.Sequence();
    73.     mySequence
    74.         .Append(battleCardCopy.ShutCard())
    75.         .Append(trapCardCopy.ShutCard())
    76.         .Append(tweens[3])
    77.         .Insert(1.2f,tweens[2])
    78.         .Append(tweens[1])
    79.         .Append(tweens[0]);
    80. }
    81.  
     
  38. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Nemial Glad it works, and see what I wrote under here to @YaVeTaL about an addition that will probably come within the week. That said, once you add a tween to a Sequence, it's the Sequence that controls everything, and you can't play single tweens separately. So you can just PlayBackwards() the Sequence, but not a specific nested tween. Imagine a Sequence as a rendered movie timeline. Once you fill the timeline and render it, you can play it forward, backwards, jump to time, but you can't modify the inner clips.

    @YaVeTaL Based on what @Nemial said, I decided I'm gonna add some kind of AppendWithPreviousTween method (still have to find a decent name) that Inserts a tween at the insertion point of the previous one, so adding parallel stuff will be easier. I'm gonna do that as soon as I'm finished with another big piece of code (path related), and then add better documentation to the website :)
     
  39. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    QUESTION TIME!

    What do you think would be the best name for a Sequence method that inserts a tween at the position of the last inserted tween (to allow for easier insertion of parallel tweens)?

    As of now the best name I came out with is "Join". Let me know, possibly within half an hour because after that I will do it :)

    Example
    Parallel myTweenA and myTweenB, current way to do it:
    Code (csharp):
    1. mySequence.AppendInterval(1)
    2.     .Append(myTweenA)
    3.     .Insert(1, myTweenB);
    How it will work instead:
    Code (csharp):
    1. mySequence.AppendInterval(1)
    2.     .Append(myTweenA)
    3.     .Join(myTweenB);
     
    Last edited: Oct 7, 2014
  40. Raimis

    Raimis

    Joined:
    Aug 27, 2014
    Posts:
    160
    Is it just me or many of properties listed in documentation are not available? I can access basic stuff like DOLocalMoveX, but something like trasform.DOMoveX(45, 1).SetOptions(true).SetDelay(2).OnComplete(myCallback); Doesn't work. I can access SetOptions or SetDelay methods. Using v0.9.130.
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @Raimis SetOptions is not available for tweens created via shortcuts, simply because the same options are already present in the shortcuts creation method so there's no need for it. To set snapping in your chain you just do this:
    Code (csharp):
    1. transform.DOMoveX(45, 1, true).SetDelay(2).OnComplete(myCallback);
     
  42. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    NEW UPDATE 0.9.150
    • NEW: Added Sequence.Join method
    • Modified internal path architecture and logic (still early alpha)

    @Nemial With this update you can simply do this, no Insert needed:
    Code (CSharp):
    1. SequencemySequence = DOTween.Sequence();
    2. mySequence
    3. .Append(cardAffectedCopy.transform.DOShakePosition(1,5,20,90,false))
    4. .AppendInterval(0.6f)
    5. .Append(cardAffectedCopy.transform.DOLocalRotate(newVector3(0,0,-15),0.3f,false)).SetEase(Ease.InOutElastic)
    6. .AppendInterval(2)
    7. .Append(cardAffectedCopy.transform.DOMove(Vector3.zero,0.6f,false)).SetEase(Ease.OutBounce)
    8. .Join(cardAffectedCopy.transform.DOScale(newVector3(1.5f,1.5f,1.5f),0.6f).SetEase(Ease.OutBounce))
    9. .AppendInterval(1)
    10. .Append(cardAffectedCopy.transform.DOLocalRotate(Vector3.zero,0.5f,true)).OnComplete(()=>TweenComplete(5));
     
    bobmoff likes this.
  43. pixelballoon

    pixelballoon

    Joined:
    Mar 5, 2013
    Posts:
    11
    I've been using this a lot more recently, and I'm really enjoying using it, it's certainly the nicest Tween library I've used so far. I asked a while back for transform.DOShake* shortcuts and you added those in incredibly quickly - and I've been using them pretty heavily. I have one further extension request for those shortcuts though.

    I believe you can do part of the functionality using AxisConstraints, but is it possible to set per-axis scaling on the shake? I.e. passing a Vector3(0,0,1) to DOShakeRotation would just shake the Z axis - very useful for 2D - similarly for DOShakePosition, something like Vector3(0.25,1,0) would be a 25%/100%/0% shake in the X/Y/Z axis respectively.

    I've not looked into adding it myself yet, so I'm not sure how complex this might be with the current implementation, but it would be incredibly useful.

    Cheers,
    Jamie
     
  44. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @pixelballoon I like that shortcut suggestion very much! I'll see if I can add it within the end of the week. Cheers! :)
     
  45. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    @lzitmee Yep, Join() seems to be much better than AppendSimultaneouslyWithLast() :)

    PS: hell, i should still learn how to use this forum :)
     
    Last edited: Oct 8, 2014
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Ahaha good that I also scrapped AttachAndPlayTogetherTowardsTheSunset() :D
     
  47. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @pixelballoon Heya, I did it, quicker than I thought. Can you try it out and let me know if it's all good on your side too? With the attached version 0.9.160 you can now pass a Vector3 instead of a float as the "strength" value of shake tweens, which will do as you said.
     

    Attached Files:

    pixelballoon likes this.
  48. jnoffke

    jnoffke

    Joined:
    Nov 26, 2013
    Posts:
    31
    For the new DOTween Setup Menu Option, can you also make sure to clean up any .meta files that may be generated by those addon files when initially imported. I know unity cleans them up automatically, but it spams me with a bunch of warnings.

    On another note, thanks for the awesome tween engine.
     
  49. YaVeTaL

    YaVeTaL

    Joined:
    Sep 25, 2014
    Posts:
    29
    Lets deal with some unfinished business from the past: passing parameters to sequence :)

    So, here's sequence:
    Code (CSharp):
    1. serveSeq = DOTween.Sequence ();
    2.         serveSeq
    3.             .Append(transform.DOMove(destination, 0.5f, false)).SetAutoKill(false).Pause();
    i'm using it as
    Code (CSharp):
    1. public void ServeAnimated(Vector3 positionTo)
    2.     {
    3.         destination = positionTo;
    4.         serveSeq.Restart ();
    5.     }
    where destination is, obviously, a field. However, tiles are jumping to (0,0), not to destination point.
     
    Last edited: Oct 8, 2014
  50. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    @jnoffke Ooops didn't get any warning so I didn't think it was a problem, but I'll take care of it.

    @YaVeTaL It's not unfinished, it's final :p When you pass "destination" as an end value, it is taken as a value, not as a reference. So if you change the "destination" variable later on nothing happens. That said, you can change a tween's start/end value with these methods, but you cannot do that to tweens that are inside Sequences.