This article mainly introduces JavaScript code for implementing 3D image rotation and display effects, which can realize 3D Rotation and transformation effects of page elements, and involves related techniques of JavaScript dynamic mathematical operations, for more information about how to implement 3D image rotation by using JS, see the example in this article. Share it with you for your reference. The details are as follows:
This is a piece of JavaScript code, which is used to rotate and display JavaScript images in a 3D model. For convenience of demonstration, the image is replaced with a number and the image location is reserved, which is faster, anyone who knows HTML knows how to do it. The rotation of this image requires manual control. The image is rotated once every click, which is very convenient.
The running effect is as follows:
The Online Demo address is as follows:
Http://demo.jb51.net/js/2015/js-3d-pic-scroll-show-style-codes/
The Code is as follows:
Rotating ImagesScript var len; var showerObj; var listObj; var showerWidth = 800; var showerHeight = 400; var r; var cR = 0; var cR = 0; var timer = 0; window. onload = function () {showerObj = document. getElementById ("show"); listObj = showerObj. getElementsByTagName ("p"); len = listObj. length; r = Math. PI/180*360/len; for (var I = 0; I
1
2
3
4
5
6
7
8
9
0
A
B
1
2
3
I hope this article will help you design JavaScript programs.