GIF can implement rotated pictures, but how to use JS implementation. I think about it, and intend to realize it, the overall idea is very simple, every once in a while, rotating a piece, it looks like it has been spinning. Instance Address
The code for rotating rotate.js is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21st 22 23
|
/** * Created by YD on 5/7/15. * Base on Jquery */ var ele;
Custom functions $.fn.extend ({ Rotate:function () { Ele = this; SetInterval (' singlerotate () ', 20); } });
Initial angle var degree = 0;
One-time rotation function Singlerotate () { Increase by 50 degrees at a time degree = degree + * MATH.PI/180; ELE.CSS ("transform", "Rotate (" +degree+ "deg)"); } |
Just a reference to JS in the code, I put it in the package on the server, you can directly reference the
1 |
<script src=" Http://libs.codeboy.me/js/rotate/1.0/rotate.js "></SCRIPT> |
Remember to refer to jquery before referencing, and finally call the rotate method in your own code.
1
|
$ (Element). Rotate (); |
For more articles, please visit the little Fat Xuan .
JS implementation of rotated pictures