' Spring 0.32
' Physics Challenge
' Copyright (c) 2012 Nonki Takahashi. All rights reserved.
'
' History:
' 0.32 2012/10/14 Work on the web too + restart option by GoToLoop. (JDR564-4)
' 0.31 2012/10/14 Minor change. (JDR564-2)
' 0.3 2012/10/14 Changed to use image. (JDR564-1)
' 0.2 2012/10/13 Timer event mod by GoToLoop. (JDR564-0)
' 0.1 2012/10/13 Created. (JDR564)
'
title = "Spring 0.32"
msg = " - Hit start/pause, restart, any other key quit."
GraphicsWindow.Title = title + msg
CR = Text.GetCharacter(13)
scale = 3139 ' [dot/m]
l = .06 ' spring length [m]
w = .006 ' spring width [m]
le = .006 ' spring edge length [m]
k = 20 ' spring constant [N/m]
m = .01 ' mass of weight [kg]
d = .01 ' diameter of weight [m]
g = 9.8 ' acceleration of gravity [m/(s^2)]
xs = .1 ' stationary point from left [m]
ys = 0 ' stationary point from top [m]
x0 = xs - d/2
y0 = ys + l
y = y0 + l ' initial position of weight
v0 = 0
v = v0 ' initial velocity of weight
fps = 12 ' frame rate [FPS (frames per second)]
time = Math.Round(1000 / fps)
dt = time / 1000
isLocal = "False"
InitWeight()
Animation()
Timer.Tick = Animation
Timer.Interval = time
Timer.Pause()
isPaused = "True"