ProcessingJS can be used for making games and visualizations. And as a consequence, you can make illustrations as well!
Scenes are snapshots in a game.
if statement logics and mouse pressed keywords.A random walker code:
// Adapted from Dan Shiffman, natureofcode.com
var Walker = function() {
this.x = width/2;
this.y = height/2;
};
Walker.prototype.display = function() {
stroke(0, 0, 0);
point(this.x, this.y);
};
// Randomly move up, down, left, right, or stay in one place
Walker.prototype.walk = function() {
var choice = floor(random(4));
if (choice === 0) {
this.x++;
} else if (choice === 1) {
this.x--;
} else if (choice === 2) {
this.y++;
} else {
this.y--;
}
};
var w = new Walker();
var draw = function() {
w.walk();
w.display();
};