plotter
Log in to post a comment.
const borderSize = 10; // min=0.1, max=50, step=0.1
const middleSize = 1.8; // min=0.1, max=100, step=0.1
const amplitude = -86; // min=-100, max=100, step=0.1
const width = 150; // min=10, max=200, step=1
const depthness = 0.1; // min=0.1, max=3, step=0.01
const factor = 1.3; // min=0.01, max=2, step=0.01
const startX = -75; // min=-100, max=100, step=0.1
const startY = 75; // min=-100, max=100, step=0.1
Canvas.setpenopacity(1);
const turtle = new Turtle();
turtle.penup();
const frequency = depthness / width;
const iterations = Math.PI / frequency;
const stepSize = width / iterations;
drawSineCircle(iterations, frequency, amplitude, startX, startY, stepSize, borderSize, middleSize);
drawSineCircle(iterations, frequency, amplitude * factor, startX, startY, stepSize, borderSize * factor, middleSize * factor);
drawSineCircle(iterations, frequency, amplitude * factor * factor, startX, startY, stepSize, borderSize * factor * factor, middleSize * factor * factor);
function drawSineCircle(iterations, frequency, amplitude, startX, startY, stepSize, borderSize, middleSize) {
turtle.goto(startX+borderSize, startY);
turtle.pendown();
for(let i = 0; i < iterations; i += 0.1) {
const t = i / iterations;
const currentSize = borderSize + (middleSize - borderSize) * Math.sin(t * Math.PI);
const y = startY + Math.sin(i) * currentSize + Math.sin(3*Math.sin(3*Math.sin(i*frequency)))*amplitude;
const x = startX + Math.cos(i) * currentSize + i * stepSize;
turtle.goto(x, y);
}
turtle.penup();
}