Last active
June 6, 2017 13:46
-
-
Save mariorcardoso/297642ebadfdd23b63523e2194c92825 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rectangle { | |
constructor(height, width, color) { | |
this.height = height | |
this.width = width | |
this.color = color | |
} | |
draw(layer, stage) { | |
const rectangle = new Konva.Rect({ | |
x: Math.random() * stage.getWidth(), | |
y: Math.random() * stage.getHeight(), | |
width: this.width, | |
height: this.height, | |
fill: this.color, | |
stroke: this.color, | |
strokeWidth: 1, | |
draggable: true, | |
shadowColor: 'black', | |
shadowBlur: 10, | |
shadowOffset: {x: 5, y: 5}, | |
shadowOpacity: 0.6, | |
scale: {x: 1, y: 1}, | |
startScale: 1 | |
}); | |
layer.add(rectangle); | |
} | |
} | |
export { Rectangle } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Rectangle } from './rectangle' | |
class Square extends Rectangle { | |
constructor(size, color) { | |
super(size, size, color) | |
} | |
} | |
export { Square } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
code samples used here: https://revs.runtime-revolution.com/want-to-use-es6-with-rails-right-now-webpack-to-the-rescue-ebefb2004e9e