This tutorial is a continuation of the move shape tutorial.
We use:
We start with the following code:
We use ColorInterpolator
node to change shape color.
The operation of ColorInterpolator
is the same as CoordinateInterpolator2D.
ColorInterpolator use
key and keyValue fields to compute and return a color when node
receive set_fraction event.
Define the ColorInterpolator node:
Link ColorInterpolator node with timer and shape color:
Final code for color animation:
ScalarInterpolator is
used if animation change only one simple value (example: angle, transparency,
radius, ...).
The operation of ScalarInterpolator
is the same as CoordinateInterpolator2D.
ScalarInterpolator use
key and keyValue fields to compute and return a float value when
node receive set_fraction event.
We can change shape transparency with this interpolator.
Define the ScalarInterpolator node:
Link ScalarInterpolator node with timer and shape transparency:
Final code for transparency animation:
Same tutorial than transparency. A ScalarInterpolator generate angles and change shape.
Note:
Rotation increases processing and memory consumption.
Rectangle shape does not rotate. We use an IndexedFaceSet2D
node in this tutorial.
Final code for rotation animation: