I came across a script and I am unable understand behaviour of the script.
Here is the script:
//The wakky script that move images...
DI=document.images; //return all the images on the page...in array so DI is array now
DIL=DI.length; //get length of DI array so it can be used for getting all images one by one in the loop below
for(i=0; i<DIL; i++)
DIS=DI[ i ].style; //get style of each image and store in DIS
DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; //change position of every image after interval of 5ms
R++ //change R which is used in setting the position so that with each function call each image will have new position.
setInterval('A()',5); //setInterval calls given function reference or expression at each interval spec in ms.
void(0) //just to indicate that function is not returning anything.
//The spead of changing position changes with each stroke of "Go". This is a puzzle for me right now.
Now what it does is, it takes all the images from ur document and rotates it like a marry-go-round or something. All u need to do for it is u just copy whole script in one line and paste in the address bar and it starts working.
Now when u click the "Go" button in the browser every time its speed is increasing.with each click it gets faster.
The code I have understood, I have written comment for, but this thing I am unable to understand.
I know this script is of no use except having fun, but still I wanna understand the behaviour, just for knowledge.
If anybody have some spare time than please help me.
No replies to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users