forked from CraftArt/SolarFlare
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.js
More file actions
30 lines (25 loc) · 722 Bytes
/
Shape.js
File metadata and controls
30 lines (25 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
class Shape{
constructor(width, height, tip){
this._points = [];
this._points.push('0,0');
this._points.push(width + ',0');
this._points.push(width + tip + ',' + (height / 2));
this._points.push(width + ',' + height);
this._points.push('0,' + height);
}
get coordinates(){
return this._points;
}
}
class RootShape extends Shape{
constructor(width, height, tip){
super(width, height, tip);
super.coordinates.push(tip + ',' + height/2);
}
get coordinates(){
return super.coordinates;
}
}
//Commenting out ES6 export for the time being as Node is yet to support it
//export {Shape, RootShape};