- This topic is empty.
-
AuthorPosts
-
April 6, 2014 at 3:32 pm #167755kadiParticipant
here is the fiddle on what i am trying to do. i want to make one ball on the circle that is constant in position i.e., not spinning. the main aim is to escape constant ball(by assigning a button to jump) from the main ball. if the main ball which is rotating from my fiddle touches any of the constant ball then it should end. one point for each ball escape. i cant position a constant ball on the circle. here is an example of what i like 2 do.here is an example of what i like 2 do. http://www.lessmilk.com/9/
April 7, 2014 at 2:10 am #167778Paulie_DMemberYou’re animating the wrong object.
You don’t want the circle to rotate, you want the ball to rotate.
http://codepen.io/Paulie-D/pen/ujKsr/
Idea borrowed from Lea Verou : http://lea.verou.me/2012/02/moving-an-element-along-a-circle/
Exact positioning of the ‘static’ ball is a little more finicky.
April 7, 2014 at 8:38 am #167785kadiParticipantthanq for the reply. i just modified the code a little bit and compiled on codepen and its working but in jsfiddle doesnt seem to work and dont know what might be the reason. here are the links.
code pen: http://codepen.io/anon/pen/hKzfl
jsfiddle: http://jsfiddle.net/DPLCd/April 7, 2014 at 8:48 am #167786Paulie_DMemberMy point was that you should be using the
translate
numbers to affect the actual position of each ball…not the margin.The initial margins just center the ball, the translate options can move it around the ball…and the final positioning was done by adjusting the margin.
A far amount of math (or JS) is going to be required depending on where you want the balls to be…
April 7, 2014 at 9:48 am #167790kadiParticipantthanq paul for quick reply. i followed ur way to change the
translate
numbers and its fine. the only problem is its not executing on jsfiddle. so how can i assign a button to move colored balls back and forth to avoid collision from blue ball.codepen: http://codepen.io/anon/pen/dIxav
jsfiddle: http://jsfiddle.net/sfY72/April 7, 2014 at 10:41 am #167791kadiParticipantcode working fine in fiddle as well. just use
-webkit-transform
to make it workApril 7, 2014 at 11:35 am #167795kadiParticipantso how can i assign a button to move colored balls back and forth to avoid collision from blue ball.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.