xxxxxxxxxx
45
//MATH CONSTANTS
const tau = 2 * Math.PI;
//CURVE
let a = 5000;
const r = 100;
const tStart = 0;
const tEnd = 20;
const tStep = 0.01;
function x(t) {
return r * sin(tau * t);
}
function y(t) {
return -t;
}
function z(t) {
return r * cos(tau * t);
}
function setup() {
createCanvas(800, 800, WEBGL);
camera(0, -400, 0, 0, 0, 0, 1, 0, 0);
}
function draw() {
background(229, 255, 234, 125);
//CURVE
noFill();
stroke(0);
strokeWeight(1);
beginShape();
for(let t = tStart; t < tEnd; t += tStep) {
vertex(x(t), a * y(t), z(t));
}
endShape();
if (a > 0.1) {
a *= 0.99;
}
}