topical media & game development

talk show tell print

lib-js-animation-js-dhtml.ball.js / js



  

author: alex @requires ball.js

  
  
  
DHTML-specific implementation
parameter: {Object} id
parameter: {Object} x
parameter: {Object} y
parameter: {Object} vx
parameter: {Object} vy

  
  function DHTMLBall(id, x, y, vx, vy) {
          DHTMLBall.baseConstructor.call(this, x, y, vx, vy);
          this._id = id;
          this._elem = document.getElementById(id);
          this._elem.style.position = "absolute"; 
          this._elem.style.display = "block";
          this.move();
  }
  extend(DHTMLBall, Ball);
  
  DHTMLBall.prototype.move = function(){
          DHTMLBall.base.move.call(this);
          this._elem.style.left = this._x + "px";
          this._elem.style.top = this._y + "px";
  }
  
  DHTMLBall.prototype.clone = function(newId) {
          var newNode = this._elem.cloneNode(true);
          newNode.id = newId;
          newNode.style.zIndex = this._elem.style.zIndex + 1;
          this._elem.parentNode.appendChild(newNode);
          return new DHTMLBall(newId);
  }
  


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.