June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
29
Task/Animate-a-pendulum/BASIC/animate-a-pendulum-1.basic
Normal file
29
Task/Animate-a-pendulum/BASIC/animate-a-pendulum-1.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
MODE 8
|
||||
*FLOAT 64
|
||||
VDU 23,23,4;0;0;0; : REM Set line thickness
|
||||
|
||||
theta = RAD(40) : REM initial displacement
|
||||
g = 9.81 : REM acceleration due to gravity
|
||||
l = 0.50 : REM length of pendulum in metres
|
||||
|
||||
REPEAT
|
||||
PROCpendulum(theta, l)
|
||||
WAIT 1
|
||||
PROCpendulum(theta, l)
|
||||
accel = - g * SIN(theta) / l / 100
|
||||
speed += accel / 100
|
||||
theta += speed
|
||||
UNTIL FALSE
|
||||
END
|
||||
|
||||
DEF PROCpendulum(a, l)
|
||||
LOCAL pivotX, pivotY, bobX, bobY
|
||||
pivotX = 640
|
||||
pivotY = 800
|
||||
bobX = pivotX + l * 1000 * SIN(a)
|
||||
bobY = pivotY - l * 1000 * COS(a)
|
||||
GCOL 3,6
|
||||
LINE pivotX, pivotY, bobX, bobY
|
||||
GCOL 3,11
|
||||
CIRCLE FILL bobX + 24 * SIN(a), bobY - 24 * COS(a), 24
|
||||
ENDPROC
|
||||
Loading…
Add table
Add a link
Reference in a new issue