From 7b6c629e1ea5b05157511f1f7542e4599f324981 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 15 Nov 2016 18:11:04 -0800 Subject: [PATCH] Replaced noise with wave. --- README.md | 19 +++++++++++++++++++ scripts/ronin.brush.pointer.js | 7 +++++-- scripts/unit.command.js | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7fa4c12..8abaaee 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,27 @@ $ ! ; Clear temporary storage # 6 strands > 600,400 60' 3;> 600,400 120' 3;> 600,400 180' 3;> 600,400 240' 3;> 600,400 300' 3 ``` + ##Symmetry Brush ``` # XY > 600,400 45' 3 +``` + +##Angular Brush +``` +# Light +> 1,1;> 2,2;> 3,3;> 4,4 +# Hard +> 2,2;> 4,4;> 6,6;> 8,8 +# Horizontal Noise +> 0,10 ?1;> 0,5 ?1;> 0,-5 ?1;> 0,-10 ?1 +``` + +##Noise Brush +``` +# Tight +> 0,0.1 ?5;> 0,-0.1 ?5;> 0.1,0 ?5;> -0.1,0 ?5 +# Glitch +> ?10;> ?10;> ?10;> ?10;> ?10;> ?10;> ?10;> ?10; ``` \ No newline at end of file diff --git a/scripts/ronin.brush.pointer.js b/scripts/ronin.brush.pointer.js index 9ab650e..4202d9d 100644 --- a/scripts/ronin.brush.pointer.js +++ b/scripts/ronin.brush.pointer.js @@ -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(); diff --git a/scripts/unit.command.js b/scripts/unit.command.js index 2004b11..152dcc4 100644 --- a/scripts/unit.command.js +++ b/scripts/unit.command.js @@ -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; }