A canvas driver for Cycle.js. Great for games or art.
Currently highly experimental. Expect major breaking changes.
$ npm install cycle-canvas --save
import {run} from '@cycle/core';
import {makeCanvasDriver, rect, text} from 'cycle-canvas';
import {Observable} from 'rx';
function main () {
return {
Canvas: Observable.just(
rect({
x: 10,
y: 10,
width: 160,
height: 100,
draw: [
{fill: 'purple'}
],
children: [
text({
x: 15,
y: 25,
value: 'Hello World!',
font: '18pt Arial',
draw: [
{fill: 'white'}
]
})
]
})
)
};
}
const drivers = {
Canvas: makeCanvasDriver(null, {width: 800, height: 600})
};
run(main, drivers);
Looks like this:
Also check out the flappy bird example.
You can find the source for flappy bird here.