Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
1/**
2 * Rect
3 */
4
5( function( root, factory ) {
6 // module definition
7 if ( typeof module == 'object' && module.exports ) {
8 // CommonJS
9 module.exports = factory( require('./shape') );
10 } else {
11 // browser global
12 var Zdog = root.Zdog;
13 Zdog.Rect = factory( Zdog.Shape );
14 }
15}( this, function factory( Shape ) {
16
17var Rect = Shape.subclass({
18 width: 1,
19 height: 1,
20});
21
22Rect.type = 'Rect';
23
24Rect.prototype.setPath = function() {
25 var x = this.width / 2;
26 var y = this.height / 2;
27 /* eslint key-spacing: "off" */
28 this.path = [
29 { x: -x, y: -y },
30 { x: x, y: -y },
31 { x: x, y: y },
32 { x: -x, y: y },
33 ];
34};
35
36return Rect;
37
38} ) );