1.0.0 • Published 4 years ago
wings-js v1.0.0
Usage:
Link Wings to your web page
<script src="wings.js"></script>
Add a canvas
<canvas id="view" width="300px" height="300px">
Add View
and Component
classes to your running scope
const { View, Component } = Wings
Instantiate the view linking it to the canvas
var view = new View(document.getElementById("view"))
Create a component class (demo)
class Box extends Component {
constructor() {
super()
// set the dimensions
this.width = this.height = 50
// set colors
this.backgroundColor = 'magenta'
this.borderColor = 'cyan'
this.borderWidth = 5
}
}
Instantiate it and add it to the view
var box = new Box
view.add(box)
Locate it inside the view
box.x = box.y = 100
Add mouse reaction to it
box.on('MouseClick', () => alert('Hello, World!'))
See demos at https://manuelbarzi.github.io/wings-js