Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Chit Chat (http://www.go4expert.com/community/chit-chat/)
-   -   Check this trick ! (http://www.go4expert.com/community/check-this-trick-t17835/)

SaswatPadhi 2Jun2009 20:55

Check this trick !
 
Simple JavaScript trick which works with all browsers.
Effect is impressive if the target page contains lots of images. Just check this out :

Code: javascript

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24;x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length;function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style;DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++ }setInterval('A()',5); void(0);


NOTE :: Full credits go to the original coder. This one is not created by me.
Example :
~~~~~~~
(1) Goto this google image search on "fractals" : http://images.google.co.in/images?q=...N&hl=en&tab=wi.
(2) Let the page load fully.
(3) Copy the above script completely and paste in the address bar.

You will love the effect !

Try it on myspace, flickr etc... ;)

shabbir 3Jun2009 08:55

Re: Check this trick !
 
Really cool one but why it does not work same here on this page ?

mayjune 19Jun2009 14:50

Re: Check this trick !
 
amazing...btw you should tell how to stop it also !!! lol..
ps - after adding remove the last character i.e. semicolon it will move faster :p
don't know why though....

SaswatPadhi 19Jun2009 17:40

Re: Check this trick !
 
Quote:

Originally Posted by mayjune (Post 49952)
amazing...btw you should tell how to stop it also !!! lol..

Close the window/tab !

Quote:

Originally Posted by mayjune (Post 49952)
ps - after adding remove the last character i.e. semicolon it will move faster :p don't know why though....

Does NOT move faster for me !

mayjune 20Jun2009 00:08

Re: Check this trick !
 
@saswat

just tried, i think i know whats wrong....
you must have pasted directly without the ;
paste the normal code run it
while its running, goto the address bar and remove the last ;
then see...
i hope that works...

SaswatPadhi 20Jun2009 00:55

Re: Check this trick !
 
@ MayJune :

Oh, you are speaking about that .. Why do you need to remove the ';' then ?
Just try to run and then try re-running it. It should run faster.

FYI :

If you study the java script closely, you will notice that it has a timer that takes care of animation; with an interval 5 ms. When you re-run the code, you add another timer with the same interval, but starting at a different time, so the animation appears to be faster (as the code is executed 2x time instead of 1x, due to double timers).

mayjune 20Jun2009 01:00

Re: Check this trick !
 
@saswat
ah i see, but then the code has changed as in isn't removing the semicolon make a big difference?
also i notice if i paste this in other site, like google or i went to a wallpaper site and tried
the pictures shifted, check out google.com and see....
why it works for google image? as in what makes it tick at places..?

SaswatPadhi 20Jun2009 06:36

Re: Check this trick !
 
Removing the last semicolon is equivalent to not removing it.

The shifting of pics happens here at G4EF too. I don't yet know about its cause.

shabbir 20Jun2009 09:25

Re: Check this trick !
 
Quote:

Originally Posted by SaswatPadhi (Post 50102)
Removing the last semicolon is equivalent to not removing it.

The shifting of pics happens here at G4EF too. I don't yet know about its cause.

As I can understand It gets all the IMG tags and changes the position of the elements using Javascript

websiteslate 28Jun2009 02:17

Re: Check this trick !
 
Nice tips...thanks dear..


All times are GMT +5.5. The time now is 14:58.