JavaScript Imitates Animation (Plays Pictures in Circulating Mode)

Posted by Admin L in Web Programming & Resources on 29-08-2011.

Author: Nosa Lee
Original Address: https://www.seeksunslowly.com/js-play-pictures-animation
To reprint this article, please indicate the source, thank you.
_____________________________________

Background
Cannot do Flash, cannot do GIF, or can do GIF but do not like its definition and file size (too big).
This time, you can consider an easy way to implement animation: use JavaScript to plays preparatory pictures in circulating mode, so as to implement animation.

Do not say more words, just look the code:
1. Picture’s HTML Code
[cc lang=”html”]

[/cc]

Note: name=”playPictures” is very important, must be identical with the object reference in the following JavaScript code.

2. JavaScript code: plays preparatory pictures in circulating mode, so as to implement animation.
[cc lang=”javascript”]

[/cc]

Note: usually, you only need to change the code that assigns every picture path to pic array, above comment already emphasized this.

3. HTML Code to Activate Animation
[cc lang=”html”]

[/cc]

That is, when load the page content, call JavaScript function that plays preparatory pictures in circulating mode.

【赞赏 / Reward】

微信         支付宝         PayPal

Post a comment