xxxxxxxxxx
41
var previous;
const sig = 10, gamma = 28, beta = 8/3, dt = 0.01;
var points = [];
var wave = 0;
function setup(){
createCanvas(400, 400, WEBGL);
colorMode(HSB);
previous = createVector(0.01, 0.01, 0.01);
strokeWeight(2);
}
function draw(){
background(255);
rotateY(millis()/1000);
scale(0.4);
noFill();
var x = (sig *(previous.y - previous.x)) * dt;
var y = (previous.x * (gamma - previous.z) - previous.y) * dt;
var z = (previous.x * previous.y - beta * previous.z) * dt;
previous.add(x, y, z);
points.push(previous.copy());
wave = 0;
beginShape();
for(var vector of points){
stroke(0);
var effect = createVector(sin(wave)*5, 0, cos(wave)*5);
vector.add(effect);
curveVertex(vector.x * 5, vector.y * 5, vector.z * 5);
vector.sub(effect);
wave += PI/1500;
}
endShape();
if(points.length > 5000){
points.splice(0);
}
}