Hi everyone, i have this code…
function setup()
ellipseMode(CENTER)
displayMode(FULLSCREEN)
end
function draw()
background(255, 255, 255, 255)
noFill()
strokeWidth(5)
stroke(0, 0, 0, 255)
ellipse(WIDTH/2,HEIGHT/2,WIDTH-200,HEIGHT-200)
end
What i want to do is have a small circle follow the oval around, is that possible??
Thx
@Klupa56 It would just be a matter of increasing an angle from 0 to 360 and calculate the x,y point on an ellipse.
@Klupa56 Here’s an example.
displayMode(FULLSCREEN)
function setup()
ellipseMode(CENTER)
t=0
print(WIDTH-200)
print(HEIGHT-200)
end
function draw()
background(255, 255, 255, 255)
noFill()
strokeWidth(5)
stroke(0, 0, 0, 255)
ellipse(WIDTH/2,HEIGHT/2,WIDTH-200,HEIGHT-200)
fill(255,0,0)
strokeWidth(0)
t=t+.5
x=WIDTH/2+(WIDTH-200)/2*math.cos(math.rad(t))
y=HEIGHT/2+(HEIGHT-200)/2*math.sin(math.rad(t))
ellipse(x,y,20)
end