[Behavior] LiteTween

  • powerof2

    I just checked and it is working fine, which link is not working?

  • lunarray

    Can you make your LiteTween addon work with expressions?

    I'm trying to make an object move from 1 part of the screen to another. Variables don't work because I'm trying to use Positions, which is both X and Y, and I can't include a "," in the variable, or it will screw it up.

    Here is a link to my forum post of my problem.

    https://www.scirra.com/forum/how-do-i-make-an-object-go-to-an-x-y-of-the-screen_t180346

  • LiteTween

    Download Link: LiteTween v.1.7

    Manual in PDF: Download

    Warning: This is a behavior, not a plugin, so it should go to behavior folder, not plugin folder.

    If you need the older v1.5 litetween which is the stable one, this is the place. I added some new feature in 1.7, shouldn't affect much, but just for precaution.

    Download Link: LiteTween v.1.5

    UPDATE

    FIX 19/7/2016: Fixing problem with minification and fixing minor typo.

    FIX 24/6/2016: Fixing Tween() expression for version 1.7

    ADD 17/6/2016: Added parameter changing for easing, back and other stuff.

    ADD 17/12/2015: Added LiteTween.Tween(a, b, x, type) function, behaving like lerp(a,b,x)

    *: x must be between [0.0, 1.0] or it will clamp it unlike lerp, because tween can't extrapolate value

    **: type is the index of tween type, setting it to 0 will use linear tween, 27 would be EaseInOutSmoothstep, etc

    FIX 14/7/2015: Re-fixing flip and mirror

    FIX 19/6/2015: Three digit version number 1.2.1 changed to 1.3

    ADD 18/6/2015: Added State expression and IsReversing Condition

    ADD 4/6/2015: Add save/load support

    FIX 5/7/2014: Fixed issue of scale tween with flipped or mirrored sprites

    CHANGE 29/6/2014: Added new 'force refresh' option when starting tween

    ADD 15/5/2014: Added Flip Flop PlayMode

    ADD 15/5/2014: Added Scale tweening

    FIX 3/3/2014: Fixed issue with EaseInOutBack

    FIX 24/1/2014: Fix issue with multiple litetween and value tween on one sprite

    FIX 22/1/2014: this.active now store tween active status instead of playmode, and updated on tick to make it more compatible with Tween2Effect

    ADD 4/12/2013: Add explanation about position tween in this post, please check below

    ADD 4/12/2013: Added Loop play mode

    FIX 4/12/2013: Fixed a typo for set target (relative) in height tween

    FIX 21/11/2013: Fixed specific bug when angle tween is used with compromise mode

    ADD 21/11/2013: Added Horizontal/Vertical tweened property

    ADD 21/11/2013: Added Ping Pong

    FIX 5/10/2013: Fixed the height tween only accepting x,y parameter

    FIX 5/10/2013: Fixed the events firing related to previous bug

    FIX 3/10/2013: Fixed the events firing only once bug

    FIX 3/10/2013: Fixed the height tween bug

    FIX 3/10/2013: Fixed the target property throwing js error

    ADD 18/09/2013: Add absolute/relative on property edit

    ADD 20/07/2013: Add value tween, value property

    FIX 01/07/2013: Resource hog on OnTick

    FIX 01/07/2013: Fixed the set parameter bug.

    FIX 01/07/2013: Now accept zero duration, it will instantly go to target.

    ADD 28/06/2013: Added safeguard against set duration of zero and negative.

    FIX 28/06/2013: Removed console.log messages in runtime

    FIX 28/06/2013: Added safeguard, ignored set target with NaN value.

    FIX 28/06/2013: Small typo fix of "set duration {1}" in edittime

    I am going to retire the old EaseTween due to it having complication with bugs after so many feature request. After realizing how hard it is making a simple mouse enter, sprite go big, mouse leave sprite go small, I decided to make this LiteTween plugin.

    I will try to keep this one lean, efficient and usable, learning from previous experience of so many feature creeps.

    This plugin won't be compatible with EaseTween.

    You can also control effect's parameter with LiteTween if you use this behavior by rex_rainbow.

    Tween2Effect by rex_rainbow

    How to use LiteTween

    -----------------------------------------

    Position, Horizontal dan Vertical tween

    In design mode, litetween accepts position in format x, y

    Example case 1, you want to tween a sprite from current position to the coordinate 200,100

    How to do that in the design view (not on event sheet):

    a. Set Target to 200,100.

    b. Set Target Mode to Absolute

    c. Make sure Active on Start is 'Yes'

    Example case 2, you want to move a sprite to left by 100 pixel using the design view

    a. Set Target to -100, 0

    b. Set Target Mode to Relative

    c. Make sure Active on Start is 'Yes'

    Note: Or you can just use Horizontal tween

    Example case 3, you want to move a sprite to left by 100 pixel, whenever your user click the sprite (on the event sheet)

    a. Create an on touch sprite condition

    b. Make a litetween action Set Target X (relative), value -100

    c. Make a litetween action Set Target Y (relative), value 0

    d. Start the tween "from the beginning"

    Note: Or you can just use Horizontal tween

    Warning: Set X and Set Y action is an inseparable pair on position tween.

    If you do a Set X action, don't forget to do a Set Y action too. Many people think it is a bug, where it is actually not . A Set X action without a set Y action will use previous Y, even in relative mode, causing all kind of unexpected problem...

    Note: The same apply with Set Y without a Set X.

    Angle tween

    Angle accepts value in degrees. That is to rotate three times clockwise, just enter 1080 in value. To rotate three times counter-clockwise, enter -1080 in value.

    Opacity tween

    Opacity accepts value from 0 (fully transparent) to 100 (fully opaque).

    You can actually set it beyond 100.

    Value tween

    Value accepts any float number as target.

    1. Set starting value using 'Set Value' action.

    2. Set target value using 'Set Target' action.

    3. Start the tween.

    4. To check the current value use the Value expression.

    Size tween

    Size tween accepts target size in pixel in format width,height as target.

    Width tween accepts target size in pixel.

    Height tween accepts target size in pixel.

    Download Demo

    Demo CAPX

    LiteTween Seek Demo

    LiteTween Stretch Demo (spam click on the right apple)

    LiteTween Demo

    DEPRECATED/OLD VERSION

    ------------------------------

    I provide these download links for peoples who are using older easeTween version in their projects.

    EaseTween 1.6 Behavior

    EaseTween 1.4.1 Behavior

    EaseTween 1.1 Behavior

    This is the demo capx

    Older Demo CAPX: capx

    This is the VN-GUI demo because some people asks me what this component is useful for.

    Live Demo: VN Demo

    CAPX: VN Demo capx

    This is the reference demo

    Live Demo: EaseTween Reference

    CAPX: EaseTween Reference capx

    If you like this behavior please leave a comment. Thanks lunarray2014-01-25 17:51:18

    Hello I have a problem about plugin

    when I exported my project to HTML5. I found "lunarray litetween" didn't work on Chrome browser and others Why? and How should I do. Please help.

    Thank you

  • lunarray - Wow. I did not know I need this behavior until now... I use lerp/dt but found out it's not smooth. lunarray - Can I ask why this plugin is smoother than lerp/dt?

    Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • krisnk

    I tested on chrome browser and it worked fine, can you be more specific about the steps to reproduce the problem? And also, this is a wild guess but it is a behaviour, not a plugin, so you should put it into behavior folder, not plugin folder, maybe that is why?

    UltimateArceus3

    It does work with expression to some extent; Though you need to know how to convert numerics into strings and vice versa.

    I don't really understand the problem you encounter, are you using Set Target X and Set Target Y? Or are you using create/initialize tween? Sometimes using Set Target X and Set Target Y would be more convenient, depending on the case. I could help more if you could provide me with a simple capx describing what you want.

    I am not sure either. If it is on the weaker device with less processing power, it might be because LiteTween is using precalculated array instead of having to calculate the lerp every tick, so it is lighter on the CPU. But if it is on an adequate PC/mobile, lerp/dt should have about the same smoothness with linear LiteTween.

  • krisnk

    I tested on chrome browser and it worked fine, can you be more specific about the steps to reproduce the problem? And also, this is a wild guess but it is a behaviour, not a plugin, so you should put it into behavior folder, not plugin folder, maybe that is why?

    UltimateArceus3

    It does work with expression to some extent; Though you need to know how to convert numerics into strings and vice versa.

    I don't really understand the problem you encounter, are you using Set Target X and Set Target Y? Or are you using create/initialize tween? Sometimes using Set Target X and Set Target Y would be more convenient, depending on the case. I could help more if you could provide me with a simple capx describing what you want.

    I am not sure either. If it is on the weaker device with less processing power, it might be because LiteTween is using precalculated array instead of having to calculate the lerp every tick, so it is lighter on the CPU. But if it is on an adequate PC/mobile, lerp/dt should have about the same smoothness with linear LiteTween.

    lunarray

    Thanks! That fixed it up!

  • I'm making a "simple" card flip. With this. (on touch flip this card type of thing) ... experiencing a weird behavior when someone clicks multiple times the card (multi clickers) it doesn't perform as expected. Hopefully I'll manage to clean it up. this is my test

  • lunarray I think EaseInBack is not working properly, it behaves the same as EaseOutBack

  • Cipriux

    Thank you for noticing that bug, that's a simple typo, I just fixed it. The download link is on the first page like usual. Please tell me if it is still not working correctly.

    Ragevortex

    You should use Enforce mode > Enforce. Don't use compromise for this case.

  • lunarray That fixed, thanks

  • lunarray I really love your behavior, I use it in almost all my games for the last past year, but I want to move an object from X1,Y1 to X2,Y2 using a curved line instead of straight line. I tried putting 2 behaviors on the same object but I could not manage to make them work together.

    Please have a look at this image. The image represents the object actual movement on XY plane (not a easing curve) .Do you think it can be done?

    Thanks in advance

  • Cipriux

    Sure it can do that. My wild guess for that problem is that you use Enforce instead of Compromise. Because of that, one of the tween won the enforced coordinate for the other. If you want the second graph which looked like a circleEaseOut to me, you need to tween linearly for X (Horizontal tween), and tween easeOutCircle for the Y (Vertical tween).

    I made a simple capx, I hope this is what you need.

    https://dl.dropboxusercontent.com/u/553 ... lotxy.capx

  • lunarray Thanks .That looks great !!!

  • Quick question... perhaps I'm just tired.

    When attempting your tween to a sprite that's mirrored using your 'apple' demonstration, it seems to revert back to a non-mirrored state during transition... perhaps I'm doing something wrong. I have your latest plugin (1.7) so i was wondering if there was something I can do to fix that?

    Here's an example:

    https://1drv.ms/u/s!AtM48QkzXUgxsjlQZ464P5dkxT76

    Am I doing something wrong? You'll see what I mean when you try. I created two different sizes so you can compare - it shouldn't matter the size, it should always work as intended with the code provided.

  • Can i use this LiteTween v.1.7 version for current updated version of C2 or there is new updated LiteTween version available ???

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)