0% found this document useful (0 votes)
36 views

Adding Motion in RhinoScript

This document provides instructions for adding motion and animation to RhinoScripts. It explains how to make an object follow a curve over multiple frames to create the illusion of movement. Key steps include subdividing the curve into intervals to determine the number of frames, moving the object from its original position to subsequent points on the curve for each frame, and using a class to store animation details and restore the original position after playback. The tutorial includes a sample script to animate a sphere along a curve over 750 frames.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Adding Motion in RhinoScript

This document provides instructions for adding motion and animation to RhinoScripts. It explains how to make an object follow a curve over multiple frames to create the illusion of movement. Key steps include subdividing the curve into intervals to determine the number of frames, moving the object from its original position to subsequent points on the curve for each frame, and using a class to store animation details and restore the original position after playback. The tutorial includes a sample script to animate a sphere along a curve over 750 frames.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Adding motion in RhinoScript

This tutorial explains step-by-step how to setup animation in any RhinoScript. In this
particular and simple case, we are going to move a sphere on a path that is defined by a
curve. This example can be, then, expanded to more complex scenarios: for example, using
the new animation to trigger some response, as in the case of the component wall.

In cartoons and movies, animation is achieved by rapidly displaying a sequence of pictures


that have a common structure. This method creates the illusion of movement, because our
brains will, as they are used to, reconstruct the pattern of motion from the static pieces.

How many frames

As we are going to animate an object, we will make it follow a curve. We need, therefore,
to sample this curve in a number of (small) intervals. The number of intervals will
determine the number of final frames we produce. If you plan to show your animation,
later, on a TV screen, then you can take the frame rates of the PAL or NTSC systems: the
European PAL has 25 frames per second (fps) and the American NTSC 29,97. If you plan
to show your video online, you will need relatively fewer images: at least 18 fps, but most
times 24 or 25 fps.

 For a European minute, therefore, the computer will need to render (60 s * 25
frames/s = ) 1500 frames.
 Similarly, for an American minute we will need (60 s *  29,97 frames/s = ) 1789
frames.

Subdividing the curve

To make the movement better controllable, we can, instead of subdividing the curve by
Euclidean distance, evaluate it at a fraction of its domain (in its own parameterization). We
will therefore be able of applying a weight to a control point, and it will influence the speed
in proximity of the respective knot.

 A higher weight coefficient “slows” down the movement in the area.


 Two or more control points close to each other will make the animation basically
stop for some time.
Moving the objects

RhinoScript gives us a number of methods to define the position of objects. For example,
we can calculate the volume centroid of closed Breps, or the area centroid of open meshes.
We will use these points to define the original location of our objects (O).

Because we want to follow a curve, we will need to move the object to the curve beginning,
or S. For each frame, we will move by a t parameter farther on the curve. To avoid small
summing errors, the script takes again the original coordinate and then sums the vector OS
and SN, and does NOT move every time from the previous location (P) to the next (N).
This would be subject to errors for small numbers, or for many frames.

Download

 Draw a curve, then run animator.rvb first and activity.rvb at last.

Implementation

animator.rvb
The animation details like the ID of the object we move and the original position are saved
in a class called animator. As the namespace for VBScript is shared, we can define the class
“animator” only once. Therefore, you can load the animator once for every Rhinoceros
session. The class does the job of finding out which type of object we are dealing with on
its own, so we just need to feed it an ID after initialization with the method setUp(). When
we destroy the object, such as in the case we stop the script by pressing ESC or we are
finished with our script, the object original position will be restored.

activity.rvb
The activity file will create one sphere and look for the first instance of a curve in the
document. Make sure that it can find it. Then, it will make the sphere follow the curve in
750 frames. The constant DontRenderUpTo will skip the rendering part of the loop for all
750 frames.

Other examples
Many other ways to achieve motion in Rhino are explained on the Grasshopper tools page,
at the renderAnimation link

You might also like