This short (2 min) video was created using a simple interactive Ubanita script that translated touch events into Triangle generation. See below the interesting part of that program.
For each touchMove
event, a random colored Triangle sprite is added.
For each touchEnd
event, such Triangles are created with a outwards radial velocity.
// touchMove is called when the game detects a movement in a touch
function touchMove(event) {
var dus = {};
dust.x = event.data.x;
dust.y = event.data.y;
dust.fill = randomColor();
dust.radius = 12;
dust.vx = _.random(-20, 20);
dust.vy = _.random(-20, 20);
_addTriangle(0, dust)
}
// when a player moves a (single) touch then call this function
_on("touchMove", touchMove);
// touchEnd is called when the game no longer detects a touch
function touchEnd(event) {
var dus = {};
dust.fill = randomColor();
dust.radius = 4;
for (var e = 0; e < 360; e += 5) {
var rad = Math.PI * e / 180.0
var cx = Math.cos(rad)
var cy = Math.sin(rad)
dust.x = event.data.x + (5 * cx);
dust.y = event.data.y + (5 * cy);
dust.vx = 200 * cx
dust.vy = 200 * cy
_addTriangle(0, dust)
}
}