Home > Web Front-end > JS Tutorial > Very beautiful JS image arrangement and rotation effect code_image special effects

Very beautiful JS image arrangement and rotation effect code_image special effects

WBOY
Release: 2016-05-16 19:06:57
Original
1276 people have browsed it

After reading the code, I feel that using array simulation is a bit stiff, so I re-wrote it myself, please come and pp!


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> var r=200,dv=0.01,w=100,x=400;y=100,pn=8 var pi=3.1415926575,d=pi/2; var pd=Math.asin(w/2/r);ed=pi*2/pn;smove=true function window.onload(){ var o=document.getElementById("imground"); var arrimg=o.getElementsByTagName("img"); for (n=0;n<arrimg.length;n++){ arrimg[n].onmouseout=function(){smove=true;} arrimg[n].onmouseover=function(){smove=false;} arrimg[n].onmousedown=function(){dv=dv*2} } setInterval(roundMove,20); } function roundMove(){ for (n=1;n<=8;n++){ var o=document.getElementById("p"+n) var ta=Math.sin(d+ed*n); var strFilter; if (ta<0) o.style.left=Math.cos(d+ed*n-pd)*r+x; else o.style.left=Math.cos(d+ed*n+pd)*r+x; o.style.top=ta*10+10+y; o.style.width=Math.abs(Math.cos(d+ed*n+pd)-Math.cos(d+ed*n-pd))*r; o.style.zIndex=ta*10; if (o.style.zIndex<0) strFilter="FlipH(enabled:true)" else strFilter="FlipH(enabled:false)"; if (ta<0) ta=(ta+1)*80+20; else ta=100; strFilter=strFilter+" alpha(opacity="+ta+")"; o.style.opacity=ta/100; o.style.filter=strFilter; } if (smove) d=d+dv; } </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template