Newer
Older
#!/usr/bin/env node
// Simple particle system example with Node and opc.js
// Specify a layout file on the command line, or use the default (grid32x16z)
var OPC = new require('./opc');
var model = OPC.loadModel(process.argv[2] || '../layouts/grid32x16z.json');
var client = new OPC('localhost', 7890);
function draw() {
var numParticles = 200;
var particles = [];
for (var i = 0; i < numParticles; i++) {
var radius = 0.2 + 1.5 * s;
var theta = time + 0.04 * i;
var x = radius * Math.cos(theta);
var y = radius * Math.sin(theta + 10.0 * Math.sin(theta * 0.15));
var hue = time * 0.01 + s * 0.2;
};
}
client.mapParticles(particles, model);
}
setInterval(draw, 10);