Sha256: 991146af7c81a2b653ad860126f9ab88313abe3477780630fbb49e2144d6b46d

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

/*
---
 
script: Ellipse.js
 
description: Draw ellipses and circles without a hassle
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
- ART/ART.Shape
 
provides: [ART.Shape.Ellipse]
 
...
*/

ART.Shape.Ellipse = new Class({
  
  Extends: ART.Shape,
  
  properties: ['width', 'height'],
  
  initialize: function(width, height){
    this.parent();
    if (width != null && height != null) this.draw(width, height);
  },
  
  draw: function(width, height){
    var path = new ART.Path;
    var rx = width / 2, ry = height / 2;
    path.move(0, ry).arc(width, 0, rx, ry).arc(-width, 0, rx, ry);
    return this.parent(path);
  },
  
  produce: function(delta) {
    return new ART.Shapes.Ellipse(this.style.width + delta * 2, this.style.height + delta * 2)
  }

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1.5 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1.4 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1.3 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1.2 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1.1 Packages/lsd/Source/ART/ART.Shape.Ellipse.js
lsd_rails-0.1 Packages/lsd/Source/ART/ART.Shape.Ellipse.js