RosettaCodeData/Task/Animate-a-pendulum/Logo/animate-a-pendulum.logo

30 lines
441 B
Plaintext

make "angle 45
make "L 1
make "bob 10
to draw.pendulum
clearscreen
seth :angle+180 ; down on screen is 180
forward :L*100-:bob
penup
forward :bob
pendown
arc 360 :bob
end
make "G 9.80665
make "dt 1/30
make "acc 0
make "vel 0
to step.pendulum
make "acc -:G / :L * sin :angle
make "vel :vel + :acc * :dt
make "angle :angle + :vel * :dt
wait :dt*60
draw.pendulum
end
hideturtle
until [key?] [step.pendulum]