Intro
This is a tutorial on how to make a bouncy DVD Screensaver,
You can also use other images such as bouncy balls or very weird bouncy memes.
Hope you enjoy!
Javascript Code
JS Code allows you to open a windows and make it bounce!
var x = 0, y = 0, w=220, h=200; // Window Size and Position.
var dx = 5, dy = 5; // Window speed
var interval = 20; // Milliseconds timeout to update.
Next we make the page in about:blank!
var win = window.open('javascript:""', "",
"width=" + w + ",height=" + h); // Open the window.
win.document.write('<style> body { background-color: black; } </style> <body> <img src="http://d-v-d.rf.gd/dvd.gif" width=200 /> </body>'); // Write the window to a GIF of the Screensaver.
win.moveTo(x,y); // Moves the Window.
var intervalID = window.setInterval("bounce()", interval); // Uses the bounce thingy.
function bounce() {
// If the user has closed the window, Stop the animation.
if (win.closed) {
clearInterval(intervalID);
return; // (still moving but very buggy)
}
// Bounce on edges.
if ((x+dx > (screen.availWidth - w)) || (x+dx < 0)) dx = -dx;
if ((y+dy > (screen.availHeight - h)) || (y+dy < 0)) dy = -dy;
// Updates the Position of the Window.
x += dx;
y += dy;
win.moveTo(x,y); // Move the updated window!
}
The Stop Button!
Close the Windows to prevent more bouncy bouncy!
<form>
<input type="button" value="Stop"
onclick="clearInterval(intervalID); win.close();">
</form>
Rules
Don’t use this code to make a virus simular to YouAreAnIdiot on IF, It’s just kinda weird and gets you bonked with the suspended hammer.
You may use this for alerts and also memes but don’t make it too fast.
You MUST include a Stop Button.
Also don’t use it for anything else bad.
Demo
http://d-v-d.rf.gd