rehearsal


Direct Link

Source code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>rehearsal - Interactive DHTML art-demos</title>
<meta name="Author" content="Gerard Ferrandez at http://www.dhteumeuleu.com">
<meta http-equiv="imagetoolbar" content="no">
<style type="text/css">
html {
overflow: hidden;
}
body {
margin: 0px;
padding: 0px;
background: #000;
position: absolute;
width: 100%;
height: 100%;
filter: alpha(opacity=100);
}
#G1D {
position:absolute;
}
</style>
<script type="text/javascript">
// ================================================
// script: Gerard Ferrandez - Ge-1-doot - OCT 2K2
// http://www.dhteumeuleu.com
// ================================================
object = new Array();
var nx = 0;
var ny = 0;
var N = 13;
var RAD = 0;
var ABS = .2;
var STR = .1;
var DEP = 800;
var xm = 1E9;
var ym = 0;
function CObj(N,L,T,img){
this.obj = document.createElement("img");
this.obj.src = img.src;
this.obj.style.position = "absolute";
this.obj.style.left = "-1000px";
document.getElementById("G1D").appendChild(this.obj);
this.w = this.obj.width * .5;
this.h = this.obj.height * .5;
this.obj.style.zIndex = Math.round(this.w);
this.L = L;
this.T = T;
this.ddx = 0;
this.ddy = 0;
this.PX = nx / 2;
this.PY = ny / 2;
this.ABS = ABS - (this.w / DEP);
}
CObj.prototype.GE1 = function (){
var dx = xm - this.L;
var dy = ym - this.T;
var d = (dx * dx + dy * dy);
if(d < RAD) {
var x = xm;
var y = ym;
} else {
var x = this.L;
var y = this.T;
}
this.PX += (this.ddx += ((x - this.PX) * STR - this.ddx) * this.ABS);
this.PY += (this.ddy += ((y - this.PY) * STR - this.ddy) * this.ABS);
if(Math.abs(this.ddx)>.01 || Math.abs(this.ddy)>.01){
this.obj.style.left = Math.round(this.PX - this.w)+"px";
this.obj.style.top = Math.round(this.PY - this.h)+"px";
}
}
document.onmousemove = function(e){
if (window.event) e = window.event;
xm = (e.x || e.clientX);
ym = (e.y || e.clientY);
}
onload = function() {
nx = document.body.offsetWidth;
ny = document.body.offsetHeight;
RAD = nx * nx * .07;
var DOOT = document.getElementById("doot").getElementsByTagName("img");
var Ni = DOOT.length;
var Un = ny-(ny/N)/2;
var k = 0;
for(var i=0;i<N;i++){
var Ge = (nx/N)/2;
for(var j=0;j<N;j++){
object[k] = new CObj(k++,Ge,Un,DOOT[k%Ni]);
Ge += nx / N;
}
Un -= ny / N;
}
setInterval(function() {
var i=0,o;
while (o = object[i++])
o.GE1();
}, 16);
}
</script>
</head>
<body>
<div id="G1D"></div>
<div id="doot" style="display: none">
<img src="../images/creationg2.gif">
<img src="../images/creationgP.gif">
<img src="../images/creationgP.gif">
<img src="../images/creationgP.gif">
</div>
</body>
</html>

Tagged with:
 

Feed updates subscription

Enter your email address:

Delivered by FeedBurner

Donate

Want to give me some extra encouragement ?

License

Creative Commons License

Except where otherwise noted, all Javascript code on this site is licensed under a Creative Commons License.