Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused getNoise and cleaned up tabs #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions trunk/sketch.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
let sketch = function(p) {

let rings = 50;
let dim_init = 50;
let dim_delta = 4;
const rings = 50;
const dim_init = 50;
const dim_delta = 4;

let chaos_init = .2;
let chaos_delta = 0.12;
let chaos_mag = 20;
const chaos_init = .2;
const chaos_delta = 0.12;
const chaos_mag = 20;

let ox = p.random(10000);
let oy = p.random(10000);
Expand All @@ -19,7 +19,6 @@ let sketch = function(p) {
p.smooth();
p.noFill();
//p.noLoop();

}

p.draw = function() {
Expand All @@ -33,24 +32,18 @@ let sketch = function(p) {
oy-=0.02;
oz+=0.01;
for(let i = 0; i < rings; i ++){
p.beginShape();
p.beginShape();
for(let angle = 0; angle < 360; angle++){
let radian = p.radians(angle);
let radius = (chaos_mag * getNoiseWithTime(radian, chaos_delta * i + chaos_init, oz)) + (dim_delta * i + dim_init);
const radian = p.radians(angle);
const radius = (chaos_mag * getNoiseWithTime(radian, chaos_delta * i + chaos_init, oz)) + (dim_delta * i + dim_init);
p.vertex(radius * p.cos(radian), radius * p.sin(radian));
}
p.endShape(p.CLOSE);
p.endShape(p.CLOSE);
}
}

function getNoise (radian, dim){
let r = radian % p.TWO_PI;
if(r < 0.0){r += p.TWO_PI;}
return p.noise(ox + p.cos(r) * dim, oy + p.sin(r) * dim);
}

function getNoiseWithTime (radian, dim, time){
let r = radian % p.TWO_PI;
const r = radian % p.TWO_PI;
if(r < 0.0){r += p.TWO_PI;}
return p.noise(ox + p.cos(r) * dim , oy + p.sin(r) * dim, oz + time);
}
Expand Down