University programming project

University programming project
0

#1

Hello everyone, I’m doing a university project and I want to make a spiral with an ellipse to start following the space in between the spiral from the center until the end of the spiral and then to start doing the same automatically. So my question is how can I make the ellipse following the spiral space? This is my code so far:


float time;

void setup()
{
size(900,850);
background(#FFFFFF);
stroke(#000203);
smooth();
time=3;
}

void draw()
{
translate(width/2,height/2);
strokeWeight(4);

beginShape();
for(int t=0;t<205;t++)
{
curveVertex((t*2)*sin(t/4.0),(t*2)*cos(t/4.0));
}
endShape();

ellipse(47/2,42/2,35,35);
}
PVector spiral(float t){
return new PVector(t*2*sin(t/4.0),t*cos(t/4.0));
}

#2

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.