Fly Images with JavaScript


Found something cool just now on Digital Point forum. You can actually make images on any website to move and fly around your screen. It’s really something cool to do – but you might feel dizzy after looking those flying images too much. So here is how you do it.

  1. Go to any website that have images on them.
  2. When you are on the website, copy and paste the code below to your address bar.

    avascript: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.getElementsByTagName("img"); 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)+'px'; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+'px'}R++}setInterval('A()',5); void(0);

    Example:
    jsadbar.jpg

  3. Click “Go” or push the “Enter” button on your keyboard.
  4. By then, you should see images from the website swinging here and there on your screen.

Have fun ~

Source: StopGeek via Digital Point

4 thoughts on “Fly Images with JavaScript

  1. It’s still working for me. Maybe you can try it at Google’s image search. Search for any keyword in Google’s image search, and copy & paste the code the the address bar. After that, click “Go” or press “Enter”. The image will move around by then.

  2. Please fix your quotes
    They should all be single or double quotes and not typographical ones like you have now in two different flavours (FF3)

    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.getElementsByTagName(“img”); 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)+’px’; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+’px’}R++}setInterval(‘A()’,5); void(0);

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>