create a toxi.math.waves.SineWave
to modulate movement with Lissajous,
parameters are phase
, frequency
, amplitude
, offset
var wx = new SineWave(0, random(0.01, 0.08), bounds.width * 0.5, bounds.getCentroid().x),
wy = new SineWave(0, random(0.01, 0.08), bounds.height * 0.5, bounds.getCentroid().y);
this.curve = new Lissajous(wx, wy);
}
ClipCell.prototype.update = function(){
this.curve.update();
this.dot.set(this.curve.x, this.curve.y);
};
ClipCell.prototype.draw = function(useClipping){
var poly = this.dot.toPolygon2D(30);
if(useClipping){
var clipper = new SutherlandHodgemanClipper(this.bounds);
poly = clipper.clipPolygon(poly);
}
beginShape();
poly.vertices.forEach(function(v){
vertex(v.x, v.y);
});
endShape(CLOSE);
}