net.nexttext.behaviour.dform
Class Throb
java.lang.Object
net.nexttext.behaviour.AbstractAction
net.nexttext.behaviour.dform.DForm
net.nexttext.behaviour.dform.Throb
- All Implemented Interfaces:
- Action
public class Throb
- extends DForm
A DForm which throbs the TextObject.
Think of throb as a multiplication of the size of the object, which
changes over time.
In order to improve interoperability with other DForms, the period of the
throb is tracked as a frame count specific to each TextObjectGlyph. This
way, each time the behaviour is called it modifies the control points of the
Glyph by multiplying them by the appropriate factor, thus preserving any
other modifications.
The following calculation defines throb with a period p
and
scale of s
. Given a vector c
from the center of
the glyph to one of its control points, it's throbbed value for frame
f
is
p * ( ( s - 1 ) * ( ( cos( f / p * 2PI - PI ) ) + 1 ) + 1 )
XXXBUG: If the period or scale is changed after the behaviour has been
started, then it will mess up any objects that are already throbbing. The
way to correct this problem is to cache the period and scale along with the
frame count, and only update them when a throb is completed.
Constructor Summary |
Throb(float scale,
int period)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Throb
public Throb(float scale,
int period)
- Parameters:
scale
- is amount the object's size will increase, as a multiplier.period
- is the period of the throb, in frames.
behave
public Action.ActionResult behave(TextObjectGlyph to)
- Description copied from class:
DForm
- DForms generally just make sense on TextObjectGlyphs.
- Specified by:
behave
in class DForm