How to make bouncy line and spring joint???

Hi guys,
so here i want to make bouncy animation.
The first one is when i slide a line lets say clothes line. the line will bounce up and down.
And the second one is spring joint animation. there is a duck above the spring. when i slide it, the duck
will bounce up and down, right and left.

please help. sorry for my bad english btw

I am assuming you are using Box2D for physics simulation.
To implement spring joint effect you need to apply linearimpulse or increase velocity of the duck body at certain time and position…

Certain time and position means first you need to implement contact listener which can identify contacts of other bodies with spring body…
Now once you have contact true for duck body and spring body then check the condition for slide line (may be some variable set to slide line or something else)

If that condition matches you can apply impulse or velocity to certain positive limit…
Also you can have different spring frames so you can apply animation of spring at the time of bounce…So it will look real

thank you viraj,

can box2d set the spring animation for me? because i think that box2d can make the swing rope animation.
do you have any suggestion about what joint i should use?
please put some code if you don’t mind.

No Box2D don’t have spring joint effect wrapper(atleast not yet)…But as i told you we can manage to have spring effect by detecting contact to spring body…
And for animation effect of the spring may be distance joint can be used…
Right now i have my personal work but at night i will definitely make demo app and post it for you…Because after all this is fun…

thanks viraj, let’s see what i can do.
i’m looking forward for the demo. really appreciate it.
and you’re right, this is fun…haha

Hey Viraj …have you done that demo app ? by any chance?