# Jelly effect with sine behavior : how to sligthly slow down

### » Wed Jun 08, 2016 8:35 pm

Hi there,

I'm working on a cap in order to make a simple jelly floor.

Here is my cap (sorry I can't post links because of limitations so I've removed the https : // ) : drive.google.com/open?id=0B3YMYyFd_M6dY2hIWjE3TUJPQUU

Here is my problem : in my cap, the sine behavior starts when the player is on the ball but it never stops... until the player get off the ball and then, it stops abrubtly.

I don't know how to make the sine behavior sligthly slowing down after it starts until it stops completly (and of course, starts again if the player move uppon it)

Cheers,

// izioq //
B
4
S
1
Posts: 24
Reputation: 380

### » Thu Jun 09, 2016 12:25 am

I would look at Hooke's law regarding spring physics. You can accomplish a jelly effect with that equation.
Here's a capx I made using the equation: https://onedrive.live.com/redir?resid=7 ... ile%2ccapx
I used it to create a jelly effect.

edit: oops, just noticed this is in construct classic: anyways, here's the equation:
F=-kx-cv
k: how strong the spring is.
x: the distance between objects.
c: dampening.
v: velocity of attached object.

application:
Self.vel = (-0.5*(Self.X-Sprite.X)-0.1*Self.vel)
Self.X += Self.X+Self.vel
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

### » Thu Jun 09, 2016 7:24 am

However I would be very glad if someone could help me regarding my question about sine behaviour because I really would like to know how to solve it as well.

@tulamide any ideas ?

Thanks!
B
4
S
1
Posts: 24
Reputation: 380