Replaced noise with wave.
This commit is contained in:
@@ -5,6 +5,7 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
||||
this.noise = null;
|
||||
this.position_prev = null;
|
||||
this.angle = null;
|
||||
this.distance = 0;
|
||||
|
||||
this.draw = function()
|
||||
{
|
||||
@@ -13,9 +14,11 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
||||
|
||||
var position = this.position();
|
||||
|
||||
this.distance += position.distance_to(this.position_prev);
|
||||
|
||||
if(this.noise){
|
||||
position.x += (Math.random() * this.noise) - (this.noise/2);
|
||||
position.y += (Math.random() * this.noise) - (this.noise/2);
|
||||
position.x += (Math.sin(this.distance/100) * this.noise) - (this.noise/2);
|
||||
position.y += (Math.sin(this.distance/100) * this.noise) - (this.noise/2);
|
||||
}
|
||||
|
||||
ronin.canvas.context().beginPath();
|
||||
|
||||
@@ -46,7 +46,7 @@ function Command(content)
|
||||
this.noise = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("?") >= 0){ return parseInt(this.content[i][1]); }
|
||||
if(this.content[i].indexOf("?") >= 0){ return parseInt(this.content[i].replace('?','')); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user