is there any example code for the following flying “clouds and plane” effect?
it looks really nice.
can anyone help me?
I just checked with my DOM Inspector, and saw that the moving cloud is an image inside a DIV element. The DIV element has a style attribute, and its ‘top’ and ‘left’ change all the time.
In java script you can do it with a function:
function move_cloud() {
cloudDiv = Document.getElementById('c2');
intTop = parseInt(cloudDiv.style.top); // Get rid of the 'px'
intTop += 1; // For example
cloudDiv.style.top = intTop + "px"; // Important to add the unit (pixels)
intLeft = parseInt(cloudDiv.style.left); // Get rid of the 'px'
intLeft += 1; // For example
cloudDiv.style.left = intLeft + "px"; // Important to add the unit (pixels)
setTimeout(100, "move_cloud()"); // 1st argument depends on how fast you want
// Your picture to move.
}
Don’t forget to initially call ‘move_cloud()’ somehow.