_DoAnimate = 1
, preferably at the beginning of your script. Depending on the front-end you may also need to activate animation. In CLUCalc this is done by selecting "Animate" from the menu "Visualization". If you activate animation at the front-end but do not include the above mentioned line, then the script is not executed at every animation step, and hence it will not be animated. Note that if you load a script in CLUCalc that does contain the line _DoAnimate = 1
, it will be animated automatically.
Simply executing the script at every time step is not of much use in itself. In order to allow for smooth animations variables Time
and dTime
are predefined. Time
contains the total time passed since the beginning of the animation in seconds. dTime
gives the elapsed time since the last execution of the script in seconds. These two variables are Scalar variables not Counters. The time resolution is typically $40 * 10^{-3}$ seconds, that is about 25 frames per second (fps). The fps of course depend on your hardware and the script.
The following example script can be found under Animate1.clu
. It shows how to animate the rotation of a vector. Also take a look at the script Inversion.clu
for a more advanced example.
// Make this script animated _DoAnimate = 1; DefVarsE3(); // Keep Angle in range 0, 360 ?Angle = (Time * 180) % 360; // Make initial vector user adjustable X = VecE3(1) + e1; // Create Rotor and draw it :R = RotorE3(0, 1, 0, Angle):MBlue; // Rotate vector and draw it :Y = R * X * ~R:Red;