xxxxxxxxxx
47
let iR = 50;
let k = 4;
let oR = k*iR;
let x;
let y;
let angle = 0;
let curve;
function setup() {
createCanvas(600, 600);
curve = new Curve();
frameRate(5);
}
function draw() {
cx = (oR/2 - iR/2) * cos(-angle);
cy = (oR/2 - iR/2) * sin(-angle);
px = cx + iR/2 * -cos(angle);
py = cy + iR/2 * -sin(angle);
background(51);
translate(width/2, height/2);
noFill();
stroke(255);
ellipse(0,0,oR);
push();
ellipse(cx, cy, iR);
strokeWeight(6);
//point(px, py);
pop();
// curve.getX(px);
// curve.getY(py);
curve.addPoint(px,py);
for(let i = 0; i < curve.path.length; i++){
curve.show();
}
angle += 0.1;
if (angle >= TWO_PI) {
curve.reset();
angle = 0;
}
}