From: Laszlo T. <las...@po...> - 2001-10-30 21:57:58
|
This slide utility was part of the DynAPI 2.0 Why was it taken out? It is very handy, and still works with the new 2.55a version (as far as I can tell from the limited testing i've done). Please put it back in the package: /* DynAPI Distribution Slide Extensions Modified: 2000.10.27 The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ DynLayer.prototype.slideTo = function (endx,endy,inc,speed) { if (endx==null) endx = this.x if (endy==null) endy = this.y var distx = endx-this.x var disty = endy-this.y this.slideStart(endx,endy,distx,disty,inc,speed) } DynLayer.prototype.slideBy = function (distx,disty,inc,speed) { if (distx==null) distx = 0 if (disty==null) disty = 0 var endx = this.x+distx var endy = this.y+disty this.slideStart(endx,endy,distx,disty,inc,speed) } DynLayer.prototype.slideStart = function (endx,endy,distx,disty,inc,speed) { if (this.slideActive) return if (!inc) inc = 10 if (!speed) speed = 20 this.slideN = Math.floor(Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc) if (this.slideN==0) return this.slideEndX = endx this.slideEndY = endy this.slideDX = distx/this.slideN this.slideDY = disty/this.slideN this.slideActive = true this.slideI = 0 this.slideInterval = setInterval(this+".slide()",speed) } DynLayer.prototype.slide = function () { if (!this.slideActive) { clearInterval(this.slideInterval) this.slideActive = false } else if (this.slideI++ < this.slideN) { this.moveBy(this.slideDX,this.slideDY) this.invokeEvent("slide") } else { this.moveTo(this.slideEndX,this.slideEndY) this.invokeEvent("slide") this.slideActive = false clearInterval(this.slideInterval) this.invokeEvent("slideend") } } |