JS implementation of rotated pictures

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.