admin管理员组文章数量:1418347
Hi I have ferris wheel graphic. It has 10 elements that forms a big circle (like a ferris wheel). I want to rotate the circle with 8 <div>
s.
How can I do that in javascript or HTML5?
Something like this.
But I need the pink to be a <div>
area so that I can put image on it.
Any suggestions&help are very much appreciated.
Hi I have ferris wheel graphic. It has 10 elements that forms a big circle (like a ferris wheel). I want to rotate the circle with 8 <div>
s.
How can I do that in javascript or HTML5?
Something like this.
But I need the pink to be a <div>
area so that I can put image on it.
Any suggestions&help are very much appreciated.
- 2 Perish wheel? You mean ferris wheel? – epascarello Commented Sep 14, 2011 at 2:41
- Do have any experienced doing it? – devzone Commented Sep 14, 2011 at 2:44
2 Answers
Reset to default 2Here's an example. Using a fairly cross-browser approach.
var rotation = 0
setInterval(function() {
$('div').css({
"-moz-transform": "rotate(" + rotation + "deg)",
"-webkit-transform": "rotate(" + rotation + "deg)",
"-o-transform": "rotate(" + rotation + "deg)",
"-ms-transform": "rotate(" + rotation + "deg)"
});
rotation = (rotation + 10) % 361
}, 200)
Very similar to IAbstractDownvoteFactory's, but all CSS. I wrote it for webkit browsers, getting the others to work should be evident but will require a lot of copy-paste.
.rotate-me {
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 8s;
-webkit-animation-name: rotate;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes rotate {
0% {-webkit-transform: rotate(0deg);}
100% {-webkit-transform: rotate(359deg);}
}
http://jsfiddle/t2fEW/
本文标签: htmlHow to create a rotating wheel with images in JavascriptStack Overflow
版权声明:本文标题:html - How to create a rotating wheel with images in Javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745289471a2651702.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论