[Behavior] LiteTween

Post your completed addons to share with the community

Post » Sun Jun 19, 2016 5:52 am

@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
B
33
S
6
G
1
Posts: 180
Reputation: 3,630

Post » Mon Jun 20, 2016 8:48 am

lunarray wrote:@Mirlas
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.
B
21
S
9
G
13
Posts: 489
Reputation: 9,263

Post » Mon Jun 20, 2016 6:14 pm

@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 :\
B
16
S
4
Posts: 356
Reputation: 2,112

Post » Tue Jun 21, 2016 1:02 am

@Mirlas

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.
B
33
S
6
G
1
Posts: 180
Reputation: 3,630

Post » Tue Jun 21, 2016 1:16 am

@Zathan
I made a quick example for it, hopefully this is what you needed.
https://dl.dropboxusercontent.com/u/553 ... value.capx
B
33
S
6
G
1
Posts: 180
Reputation: 3,630

Post » Tue Jun 21, 2016 4:13 pm

@lunarray
That's exactly what I need! hehe
Thank you very much, Luna. For the plugin and for all the help.
B
16
S
4
Posts: 356
Reputation: 2,112

Post » Sat Jun 25, 2016 7:31 am

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
Banned User
B
4
Posts: 2
Reputation: 204

Post » Sat Jun 25, 2016 7:56 am

@formuzal
formuzal wrote: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
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,850
Reputation: 48,301

Post » Sat Jun 25, 2016 8:35 am

zenox98 wrote:@formuzal
formuzal wrote: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!
Banned User
B
4
Posts: 2
Reputation: 204

Post » Tue Jun 28, 2016 4:50 pm

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).
B
10
S
2
Posts: 5
Reputation: 510

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest