all
i have a problem in trying to using jquery and css3 keyframe to move or circle an element such as div or image around a point or mouse continues, not delay time, just keep circle around.
Any solution ? please show me. thanks in advance !
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From your clarifying comments:
CSS3 Animation
To make an animation where you rotate an element around a point smoothly and continue forever, you can use these CSS3 keyframe/animation and 2D transformation properties:
animationto specify timing and which keyframes to use.animation-timing-functionto specify that you want a smooth animation (linear).@keyframesto specify exactly how to animate the element.transform-originto rotate around a point other than the center of the div (some offset).transformto move the element out from the center of rotation (radius of orbit).rotate(<angle>);to specify that you want to rotate in your keyframe(s).You will probably need to duplicate these and prefix each with
-webkit-,-moz-and-ms-for a while until the CSS3 animation features are widely supported.Specifying position in CSS/jQuery
You can use plain-old CSS to rotate an HTML element around an arbitrary point:
If you want to continually center your animation on the mouse cursor, you’ll need to use jQuery to handle the
mousemoveevent on the document, and set theleftandtopproperties of the element’s CSS.Something like:
Docs
.mousemovehandler method.csssetter methodCode Sample
I had built a code sample to research the functions and references you’d need to build this on your own. Since the other answer already gave you their code sample, I’ll go ahead and post mine.
I highly recommend you build this out yourself so you can learn how these things work 🙂
Browser Support
See this page with a CSS3 Animation support matrix, and this page with a CSS3 2D Transform support matrix.
The gist is:
-o-Tranform tags to make it work, and the Animation support just isn’t there yet)