/src/Snow.js
import Controller from './Controller';
export default class Snow extends Controller {
constructor(appState) {
super(appState);
this.penIsDown = false;
}
randomColor() {
return Math.floor(Math.random() * 16);
}
down(x, y) {
this.penIsDown = true;
this.state.pixelEditor.pushState();
this.state.pixelEditor.drawPixel(x, y, this.randomColor());
}
move(x, y) {
if (this.penIsDown) {
this.state.pixelEditor.drawPixel(x, y, this.randomColor());
}
}
up(x, y) {
this.penIsDown = false;
}
}