[Behavior] LiteTween

  • kantin

    Is this link working for you?

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

    I tried downloading it from the first post and it work, or maybe this is not the one you need?

    Just a reminder for this one you will need EaseTween behavior not the LiteTween. If you don't have it yet, download for that behavior is on my first post.

  • Hey lunarray ,

    Can you explain me why using variables or expressions in the "Create/Initialize Tween" action doesn't work?

    I have to leave the "target" empty, for example, and create a target action separately.. then i can enter expressions.

  • Zathan

    It actually work, but you have to insert it inside a double quote. For example, if you want to set target to position 300, 300. You have to write "300,300", with quote and comma.

    Also if you want to enter target angle, you would still need to enter it inside a double quote "90".

    The reason for this is because C2 editor did not let me set different UI for target whenever user changed the tween target (position, angle, etc). If it is position, it will need two value, X and Y, but for angle it would need to accept single value. The only thing i could do then is to make it a string/text in double quote, and the tween will automatically sets the right target value from the text.

    Because back then I thought create/initialize tween would not be used by most average user, I choosed to implement it like this, and if I change it now to accept two value, it will break so many people project that already use it for the last two years, they would have to fix so many things.

    I know it is not convenient but there's not much i can do with it.

  • lunarray

    Hm.. that's interesting too, but I was talking about another thing actually.

    For example, i can't enter "sprite.X,sprite.Y" in the target of a create/initialize tween, I'm just allowed to enter numbers hehe

  • Zathan

    Ah okay, you should make it a string first, so instead of "sprite.X,sprite.y", you should use

    str(sprite.x) & "," & str(sprite.y)

    or

    sprite.x & "," & sprite.y

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe I understand it wrong, but is it something like this?

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

    I think you can not synchronize the frequency of a sound with that value.

    I have an example, here I am using a tween with duration of one second, press space, then a sound plays and everything is realistic.

    https://dl.dropboxusercontent.com/u/60803633/exampleTweenSyncAudioFreqWithTweenDuration.capx

    Okay.

    But now, if I put the tween with a duration of 0.5 seconds, the sound is no longer synchronized and the results are erroneous, the sound duration is 1 second and the tween duration is 0.5 seconds.

    So could somehow get the playback speed using the tween to synchronize with the sound ?, I do not mean the duration of the tween, I mean the speed with which makes the movement, you could be achieved this somehow ?.

    I mean, synchronize frequency of a sound with the speed at which a tween runs.

    Velocity of movement, in this case is velocity of the rotation.

  • lunarray

    Ha! Thank you, Luna.

    Just one more question.. I think it have something to do with the "value" tween property...

    If I want to, for example, tween the timescale of the project, what I have to do? I tried a few thing without luck :\</p>

  • https://dl.dropboxusercontent.com/u/553 ... ation.capx

    Before you read my long comment below, maybe you want to see this capx first, if this is roughly what you wanted, then the long comment below might interest you, but if it is not, then just ignore my rambling >.<

    The velocity of movement, whether it is angular or positional, is always the 1st derivative of displacement. In this case, we can either take the formula of the used tween's function, then get the derivative of it, multiply it with some value (in here, the duration), then we get the velocity of it.

    If you use linear tween, it is so easy to get velocity because the speed at any moment is the same everywhere. The derivative of a linear function is a constant, in this example it proportionally inverse with duration.

    • So, in this case, you can set timescale of the audio to 1 for 1 sec. I just use set playback rate in the audio object to correctly change pitch also.
    • When the duration is 0.5 then the speed at any given moment of time is always 2. So set timescale to 2 for duration of 0.5 sec.
    • When the duration is 0.75, then the speed at any given moment is 1/0.75, 1.33333. So set timescale to 1.3333 for duration of 0.75.
    • For other duration, just take 1/x as timescale.

    Now the worse part.

    For other tween's formula, like elastic ease, it would be hard or even impossible to take derivative, because its function is segmented. And I can't also set the audio timescale to alter the pitch. The speed at an any exact time is different. So, in these case, the previous example of how to calculate speed in every time moment would be useful. So, each tick i get the old position/angle and take the new position and angle, and then divide it by the delta time, it will make it a very roughly approximation of the current speed. If we divide this value with the linear speed of the tween, we can get the right timescale for it.

    In this capx I stop and play the audio at every tick and adjust the timescale at every deltatime. In this capx example though, it has a clicking noise, because it is stopping abruptly during a waveform play, the way to eliminate this will be to use very quick crossfading between the microsample.

  • Zathan

    I made a quick example for it, hopefully this is what you needed.

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

  • lunarray

    That's exactly what I need! hehe

    Thank you very much, Luna. For the plugin and for all the help.

  • 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

    Could you update link? Unable to download dropbox 404 file not found

  • formuzal

    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

    Could you update link? Unable to download dropbox 404 file not found

    Looks like a period was accidently deleted in the link. Just add it before the zip, like so:https://dl.dropboxusercontent.com/u/55358831/lunarray.litetween.v1.5.zip

  • formuzal

    > 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

    >

    > Could you update link? Unable to download dropbox 404 file not found

    >

    Looks like a period was accidently deleted in the link. Just add it before the zip, like so:https://dl.dropboxusercontent.com/u/55358831/lunarray.litetween.v1.5.zip

    Thanks!

  • the tweens are not affected by construct2's "time scale".

    im getting better smoother results when moving things using the simple method of self.x+dt*speed.

    i use time scale to simulate weak devices.

    i would love some help,

    and also thank you for this addon.

    i used it a lot, and i love the cool easing options (maybe you can even let us tinker with it).

  • sagispin

    I tested it here, and both 'Set Timescale' and 'Set Object Timescale' affect the tweens. Can you give me a simple capx that shows the case where it doesn't work?

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