Advertisement
Guest User

Bait

a guest
Aug 17th, 2010
1,536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Bait = new Class({
  2.     Extends : LibCanvas.Interfaces.Drawable,
  3.  
  4.     radius : 15,
  5.     color : '#f0f',
  6.  
  7.     initialize : function () {
  8.         this.bind('libcanvasSet', function (){
  9.             this.shape = new LibCanvas.Shapes.Circle({
  10.                 center : this.createPosition(),
  11.                 radius : this.radius
  12.             });
  13.         });
  14.     },
  15.  
  16.     createPosition : function () {
  17.         return this.libcanvas.ctx
  18.             // получаем элемент LibCanvas.Shapes.Rectangle размерами равный нашему холсту
  19.             .getFullRectangle()
  20.             // Берем из него случайную точку
  21.             .getRandomPoint();
  22.     },
  23.  
  24.     draw : function () {
  25.         this.libcanvas.ctx.fill(this.shape, this.color);
  26.     }
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement