Click here to Skip to main content
15,942,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to make an object that will move in a elastic way when I pan it around. The best example I could find was this GIF I made from the game PapiRubber: (Please excuse the quality)

If you note the rubber band looking rectangle stretching about, that is what I am trying to implement in my application!
I dont really know where to begin where to start making something like that except asking for help :]

Any help will be greatly appreciated! Thank you!

1 solution

I don't know objective-C or iOS, but this is just a matter of drawing lines between two objects that can move randomly and independently of each other. If you want something similar to the animated gif, then you need to calculate a new position for each object, draw the line(s) between them, wait some random time interval, and then repeat until you get bored. Don't forget to test that each new position does not go beyond the edge of the window; in fact you can add some sort of bounce effect when it does.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900