ASNMTAP
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
applications/htmlroot/JSFX_Halloween.js view on Meta::CPAN
}
if(ns4)
JSFX.Layer.prototype.moveTo = function(x,y) { this.elem.moveTo(x,y); }
/**********************************************************************************/
/*** show()/hide() Visibility ***/
JSFX.Layer.prototype.show = function() { this.style.visibility = "visible"; }
JSFX.Layer.prototype.hide = function() { this.style.visibility = "hidden"; }
if(ns4)
{
JSFX.Layer.prototype.show = function() { this.style.visibility = "show"; }
JSFX.Layer.prototype.hide = function() { this.style.visibility = "hide"; }
}
/**********************************************************************************/
/*** zIndex ***/
JSFX.Layer.prototype.setzIndex = function(z) { this.style.zIndex = z; }
/*** Opacity ***/
if(document.all)
{
JSFX.Layer.prototype.setOpacity = function(pc)
{
if(this.style.filter=="")
this.style.filter="alpha(opacity=100);";
this.elem.filters.alpha.opacity=pc;
}
}
else
JSFX.Layer.prototype.setOpacity = function(pc) {return 0;}
/******* END OF CODE FROM JSFX.Layer.js ***/
/*** START OF CODE FROM JSFX.Browser.js ***/
JSFX.Browser = new Object();
if(navigator.appName.indexOf("Netscape") != -1)
{
JSFX.Browser.getMinX = function() {return(pageXOffset);}
JSFX.Browser.getMinY = function() {return(pageYOffset);}
JSFX.Browser.getMaxX = function() {return(pageXOffset+innerWidth);}
JSFX.Browser.getMaxY = function() {return(pageYOffset+innerHeight);}
}
else if(document.all)
{
JSFX.Browser.getMinX = function() {return(document.body.scrollLeft);}
JSFX.Browser.getMinY = function() {return(document.body.scrollTop);}
JSFX.Browser.getMaxX = function() {
return(document.body.scrollLeft
+document.body.clientWidth);
}
JSFX.Browser.getMaxY = function() {
return(document.body.scrollTop
+document.body.clientHeight);
}
}
/*** END OF CODE FROM JSFX.Browser.js ***/
/*** START OF CODE FROM JSFX.Ghosts.js ***/
JSFX.Halloween = new Object();
JSFX.Halloween.Ghosts = new Array();
JSFX.Halloween.start = function()
{
if(JSFX.Halloween.theTimer == null)
{
JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
}
}
JSFX.Halloween.animateAll = function()
{
JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
var sp = JSFX.Halloween.Ghosts;
var i;
for(i=0 ; i<sp.length ; i++)
{
sp[i].animate();
}
}
JSFX.AddGhost = function(img)
{
var myGhost = null;
var htmlStr = "<IMG SRC='"+img+"'>";
myGhost = new JSFX.Layer(htmlStr);
myGhost.op = 0;
myGhost.x = Math.random()*JSFX.Browser.getMaxX();
myGhost.y = Math.random()*JSFX.Browser.getMaxY();
myGhost.dx = 0;
myGhost.dy = 0;
myGhost.w = 30;
myGhost.h = 30;
myGhost.targetX = Math.random()*JSFX.Browser.getMaxX();
myGhost.targetY = Math.random()*JSFX.Browser.getMaxY();
myGhost.state = "off"
myGhost.animate = JSFX.animateGhosts;
myGhost.hide();
myGhost.setOpacity(this.op);
myGhost.moveTo(myGhost.x,myGhost.y);
myGhost.setzIndex(100+JSFX.Halloween.Ghosts.length);
JSFX.Halloween.Ghosts[JSFX.Halloween.Ghosts.length] = myGhost;
JSFX.Halloween.start();
}
JSFX.animateGhosts = function()
{
if(this.state == "off")
{
if(Math.random() > .99)
{
this.state="up";
this.show();
}
}
else if(this.state == "on")
{
if(Math.random() > .98)
this.state="down";
}
else if(this.state == "up")
{
this.op += 2;
this.setOpacity(this.op);
if(this.op==100)
this.state = "on";
}
else if(this.state == "down")
{
this.op -= 2;
if(this.op==0)
{
this.hide();
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.919 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )