[Behavior] LiteTween

  • Posted a fix for problem that only got caught just now...

    1. It ignores enforce mode and always stays in compromise mode.

    2. Restarting and setting initial problem fixed.

  • You might want to offer in the tips how to set the target data.


    position "100,100" or "" & self.x + 100 & "," & self.y -1 00

    Also I tried changing the name for set target to "all". This caused a javascript error. You probably want to catch invalid tween names and give a console log report. rather than letting a crash go through.

  • jayderyu

    Thanks for trying it out. I was planning to fix it all at once and make a proper demo (kinda like a documentation in form of a demo), but i got distracted with things irl...

    As for initial or target string, it currently accept these types:

    "current": The current object's opacity, angle, or position depends on the context. This is replaced by the said value when the tween is created, not when the tween is played. Example: tween got created when the object is at (120, 30), current will be replaced with (120,30) when it is first created.

    "relative(x,y)": where x, y is relative to the current position, angle or opacity. It can accept negative value. Also, this one got replaced with the said value when the tween is created.

    example: "relative(-10,100)"

    "x,y": the x,y coordinate of the target or initial string. Depends on the context of the tween, it can also accept single value as in "100" for opacity etc.

    About tween name, it accepts "all" just fine here, even for the set target too. Could you provide a capx for it?

    The special tween name would be "default", "all", "earliest" and "furthest". It depends on the context.

    "default" is the default tween which property is changed in the IDE. It is not really a special one though. It's just a tween that got named "default" and got created when we include the behavior.

    "all" means that you target all the tween in the behavior at once. It works in almost all of the action (except set parameter/create tween for kinda apparent reason :(, will fix that up later).

    "earliest" and "furthest" are captured only on progress checking, because it didn't make sense in other context.

    PS: There are some bug fixes happening when I made this post, please update it to the latest behavior. Thanks :>

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is 0.8 on the first page the newest? There seems to be something wrong.

    I've got a sprite, set it's initial to "current". Then set its target to a specific X and Y position, then every second play the tween...but it seems like it's moving its target every time the tween plays.

    Also a sprite that goes from opacity 100 to 0, only does that once. No matter if I try to play the tween again.

  • This is what I did


    Now I know I used it wrong, but this causes an error on my computer.

  • jayderyu

    I see, that was a very terrible bug on my side, I was looping the tweens with a wrong iteration variable... and copying the wrong litetween on the wrong directory.

    But this one should be fixed, I even attached a copy of setting "all" on every action with this capx.

    Fixed capx


    I think it is not a bug and has something to do with Enforce and Compromise mode. I will try to make a post about compromise vs. enforce after this.

    Try setting it to Enforce. If you could provide me with capx, I might be able to look more into it...

    I set the newest litetween (just uploaded one), now it is set with enforce mode defaulting to Enforce instead of Compromise.

  • Hm, from what I read in the description of the fields "target" is always relative? That should explain my confusion, it doesn't matter if I set enforce or compromise. Always uses target as relative, can it somehow be made static and not relative to the sprite?

  • I love your plugin and personally think with some tinkering that your tween should be standard.

    However, I find that working with strings to be annoying. Often I work calling variables from other sources. So using strings is inconvenient as I need to embed the var into a string.

    If your are going to stick with strings may I suggest splitting Set Target to

    Set Target

    Tween Name:

    Target Is: (drop down box for angle, opacity, X, Y....)

    Is Relative(true/false)


    Set Target position

    Tween Name:

    Is Relative(true/false)



    as it is now. Using it is peculiar and not very inline with how C2 works naturally. LiteTween practically uses it's own little mini language. Which could be removed and made more natural with other C2 plugins.

    Also, I'm not a big fan of the naming system. As A thought. Wouldn't just adding additional LiteTween's and renaming them in the behaviour list be more "natural" to the C2 system. I know that by adding string names for tween can reduce the number of behaviours to just 1, but only Ease/LiteTween do this that I have used.

    I know it seems I'm complaining. I'm not really. I'm just offering some thought to have it feel more intuitive and simpler to use. Other than that. Loving lunaray tween mods :) top notch and one of the best :)

  • jayderyu

    I think I see your point there, the string parsing and all are unintuitive. I think I'll try going with your suggestion for set target, and properly hide the "current" and "relative" etc from it. It is not very nice for newcomers to C2. I'll put that here after I finished it today, hopefully tomorrow it will be ready.

    About the tween naming system. I also agree that removing the naming system and go with C2 way of naming the behavior in the IDE is more eventsheet friendly. So yeah, maybe for litetween I should keep it small and should not trying to input too many features in it. Let's see what I can do with it.

    Going back to the reason I created LiteTween, is because with easetween I inputted too many features in it till it became so big (old habit dies hard). So simplifying the interface and removing features to the absolute essential is still very relevant to litetween.

    Thanks for the suggestion, I'll go with that route now.


    Can you please show it in a small capx? Because it works for me here with enforce and target (100,100). But maybe you would want to wait till I do redux like what jayderyu suggested.

  • jayderyu

    Could you try this one? I modified alot and removed "Set Initial" too.

    LiteTween 0.9


    I found the problem in the old lite tween, but i'm not going to maintain two version of litetween :(, so eventhough I fixed those bugs, you might want to try the v0.9.

    PS: I also made a simple demo for it...

    Demo CAPX

  • Had a go with 0.9, still a bit of a problem:

    I set the (absolute) target of a sprite to 100, 100 for example. Then I play the tween, so it goes from its initial position to the target. Now I play the tween again, what I then expect it to do is go back to where it was before, then go to the target but what it actually does is...nothing. Even when I seek back to 0, play (from beginning)...nothing happens.

    Here's a sample CAPX:


  • Kenney

    Ah, I see, I've checked the capx. You shouldn't be setting target every 1.0 secs (what I exactly mean is that you should set initial beforehand), it will cause the initial to be set everytime you set the target (to object current position).

    It goes kinda like this:

    1. Before the first tween, the object position is at 302,241.

    2. At 1.0 secs, c2 called set target to absolute 100,100. Because of this call, it also set the initial of the tween to 302, 241. So, right now, the tween goes 302,241 to 100,100.

    3. The tween plays, and the object is now at 100,100.

    4. After another 1.0 secs, c2 called set target 100,100 (absolute) again. But now, the object is already at 100,100. So it make a tween for 100,100 to 100,100 (which does nothing).

    The right way to set initial now is simply by setting the object position before you set target. If you add "Set Position to 302,241" before setting the target it will act just like setting initial.

    PS: Maybe I should include a capx about it :>


  • Aaaahh! Got you now! Sorry for all the trouble.

    I'm used to Flash and tweens work a bit different there (more like I described above), so that's where the confusion started.

  • Oh and, you can also just play the tween every 1.0 secs, without re-setting the target, it will work kinda the same too.

    Just one event, "every 1.0 secs > LiteTween start from beginning". :>

  • man, how to use Size?

    I just want to make a sprite bigger.

    But, it keeps using the number as X coordinates.


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