This inspired me.
I have come across this before and like to “scale” the plot that I draw and not use scale();
Not p5.js but an example.
Example with embellishments (translating, scaling and some)
long time, timeLast;
float scale = 1;
float theta;
float x, y;
void setup()
{
size(1000, 1000);
time = 1000;
timeLast = millis();
}
void draw()
{
background(0);
translate(width/2, height/2);
// Rotates in a circle
theta += TAU/500;
x = 150*sin(3*theta);
y = 150*cos(3*theta);
translate(x, y);
// if (timeLast + time < millis()) //Remove comment to see this effect
{
timeLast = millis();
//scale = 50;
// modulating scale
scale = 10*(sin(theta)+1);
}
for(float x = 0; x < TAU; x+= TAU/(scale*10) )
{
float y = 5*sin(x);
stroke(255, 255, 0);
strokeWeight(3);
point(scale*x,scale*y);
stroke(255);
line (0, -10*scale, 0, +10*scale);
line (0, 0, 10*scale, 0);
}
println(frameRate);
}