rita
Class RiTextBehavior

java.lang.Object
  extended by rita.RiTextBehavior
All Implemented Interfaces:
processing.core.PConstants, RiConstants
Direct Known Subclasses:
InterpolatingBehavior

public class RiTextBehavior
extends java.lang.Object
implements RiConstants

An abstract superclass for an extensible set of text-behaviors (found in rita.support.behaviors) including a variety of interpolation algorithms for moving, fading, scaling, color-change, etc.

Included in the rita.* package primarily to document callbacks as follows:

    public void onRiTaEvent(RiTaEvent re)
    {
      // do something with the RiText whose behavior has finished
      RiText parent = (RiText)re.getSource();  
      ...
      
      // do something with the Behavior directly
      RiTextBehavior rtb = (RiTextBehavior)re.getData();     
      ...
      
    }

Invisible:

Field Summary
 boolean completed
           
 float duration
           
static java.util.List instances
           
 float startOffset
           
 long startTime
           
 
Fields inherited from interface rita.support.RiConstants
BEHAVIOR_COMPLETED, BOUNDING_BOX_ALPHA, BRILL_POS_TAGGER, EASE_IN, EASE_IN_CUBIC, EASE_IN_EXPO, EASE_IN_OUT, EASE_IN_OUT_CUBIC, EASE_IN_OUT_EXPO, EASE_IN_OUT_QUARTIC, EASE_IN_OUT_SINE, EASE_IN_QUARTIC, EASE_IN_SINE, EASE_OUT, EASE_OUT_CUBIC, EASE_OUT_EXPO, EASE_OUT_QUARTIC, EASE_OUT_SINE, ESS, FADE_COLOR, FADE_IN, FADE_OUT, FADE_TO_TEXT, FIRST_PERSON, FUTURE_TENSE, ID, LERP, LINEAR, MAXENT_POS_TAGGER, MINIM, MOVE, MUTABLE, PAST_TENSE, PHONEME_BOUNDARY, PHONEMES, PLING_STEMMER, PLURAL, PORTER_STEMMER, POS, PRESENT_TENSE, SCALE_TO, SECOND_PERSON, SENTENCE_BOUNDARY, SINGULAR, SONIA, SPEECH_COMPLETED, STRESSES, SYLLABLE_BOUNDARY, SYLLABLES, TEXT, TEXT_ENTERED, THIRD_PERSON, TIMER, TIMER_COMPLETED, TIMER_TICK, TOKENS, UNKNOWN, WORD_BOUNDARY
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
RiTextBehavior(RiText riText)
          Creates a behavior and assigns it an Id.
RiTextBehavior(RiText riText, float duration)
          Creates a behavior to start immediately
RiTextBehavior(RiText riText, float startOffsetInSec, float durationInSeconds)
          Creates a behavior to start at startOffsetInSec seconds in the future
RiTextBehavior(RiText riText, java.lang.String timerName, float duration)
          Creates a behavior to start immediately
 
Method Summary
 void addListener(BehaviorListener bl)
          Adds a listener for events fired from this behavior, e.g., completion, upon which it will behaviorCompleted();
 void checkForCompletion()
          Checks for completion, and if so, fires the callback
 void delete()
          Optional method for subclasses needing to clean-up/release resources
(Note: implementations should generally call super.delete())
static void deleteAllFades(RiText rt)
          Stops and deletes all the behaviors for the specified RiText that are of type FADE_IN, FADE_OUT or FADE_TO_TEXT.
static void disposeAll()
          Calls delete() on all existing behaviors
static RiTextBehavior findById(int id)
           
static RiTextBehavior findByName(java.lang.String name)
           
static java.util.List findByType(int type)
           
 void finish()
           
static RiTextBehavior getBehaviorById(int id)
          Returns the behavior corresponding to the specified 'id'.
 float getDuration()
          Returns the total duration for the behavior
 int getId()
          Returns the unique Id for this behavior
 java.lang.String getName()
          Returns the user-assigned name for this behavior; Will return the class name if not set by the user.
 RiText getParent()
          Returns the RiText object in which this behavior is operating.
 float getStartOffset()
          Returns the original startOffset for the behavior
 int getType()
          Returns the type for the behavior
 float getValue()
           
 boolean isCompleted()
          Returns whether this behavior has completed
 boolean isPaused()
          Returns the paused status for the behavior
 boolean isRepeating()
          Returns whether the behavior will repeat (indefinately) when finished
 boolean isReusable()
           
 boolean isRunning()
          Returns the paused status for the behavior
 boolean isWaiting()
           
 void pause(float pauseTime)
          Pauses the behavior for 'pauseTime' seconds
static void pauseAll(boolean paused)
          Pauses/un-pauses all existing behaviors
 void reset(float durationInSec)
          Causes the behavior to be (immediately) repeated with its initial params and the specified 'duration'
static java.util.List selectByType(java.util.List behaviors, int type)
          Returns the sublist of the specified behaviors that is of the specified type, where type is generally one of (MOVE, FADE_IN, FADE_OUT, FADE_TO_TEXT, SCALE_TO, etc.)
 void setId(int id)
           
 void setName(java.lang.String name)
          Sets a (user-assigned) name for this behavior.
 void setPaused(boolean pausedVal)
          Sets the paused status for the behavior
 void setRepeating(boolean repeating)
          Sets whether the behavior should repeat (indefinately) when finished
 void setReusable(boolean reusable)
           
 void setRunning(boolean b)
           
 void setType(int type)
           
 void stop()
           
 java.lang.String toString()
           
 void update()
          Required method for all subclasses
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instances

public static java.util.List instances
Invisible:

duration

public float duration
Invisible:

startOffset

public float startOffset
Invisible:

startTime

public long startTime
Invisible:

completed

public boolean completed
Invisible:
Constructor Detail

RiTextBehavior

public RiTextBehavior(RiText riText,
                      float duration)
Creates a behavior to start immediately


RiTextBehavior

public RiTextBehavior(RiText riText)
Creates a behavior and assigns it an Id. Note: the behavior cannot start w'out first being assigned a duration.


RiTextBehavior

public RiTextBehavior(RiText riText,
                      java.lang.String timerName,
                      float duration)
Creates a behavior to start immediately


RiTextBehavior

public RiTextBehavior(RiText riText,
                      float startOffsetInSec,
                      float durationInSeconds)
Creates a behavior to start at startOffsetInSec seconds in the future

Method Detail

selectByType

public static java.util.List selectByType(java.util.List behaviors,
                                          int type)
Returns the sublist of the specified behaviors that is of the specified type, where type is generally one of (MOVE, FADE_IN, FADE_OUT, FADE_TO_TEXT, SCALE_TO, etc.)

Invisible:

deleteAllFades

public static void deleteAllFades(RiText rt)
Stops and deletes all the behaviors for the specified RiText that are of type FADE_IN, FADE_OUT or FADE_TO_TEXT.

Invisible:

getBehaviorById

public static RiTextBehavior getBehaviorById(int id)
Returns the behavior corresponding to the specified 'id'.


update

public void update()
Required method for all subclasses


isWaiting

public boolean isWaiting()

getParent

public RiText getParent()
Returns the RiText object in which this behavior is operating.


reset

public void reset(float durationInSec)
Causes the behavior to be (immediately) repeated with its initial params and the specified 'duration'

Note: ignores startOffset and restarts immediately.


finish

public void finish()

stop

public void stop()

setRepeating

public void setRepeating(boolean repeating)
Sets whether the behavior should repeat (indefinately) when finished


checkForCompletion

public void checkForCompletion()
Checks for completion, and if so, fires the callback


isCompleted

public boolean isCompleted()
Returns whether this behavior has completed


pauseAll

public static void pauseAll(boolean paused)
Pauses/un-pauses all existing behaviors

Parameters:
paused -

disposeAll

public static void disposeAll()
Calls delete() on all existing behaviors


delete

public void delete()
Optional method for subclasses needing to clean-up/release resources
(Note: implementations should generally call super.delete())


getDuration

public float getDuration()
Returns the total duration for the behavior


getStartOffset

public float getStartOffset()
Returns the original startOffset for the behavior


getType

public int getType()
Returns the type for the behavior


isRunning

public boolean isRunning()
Returns the paused status for the behavior


setPaused

public void setPaused(boolean pausedVal)
Sets the paused status for the behavior


pause

public void pause(float pauseTime)
Pauses the behavior for 'pauseTime' seconds


isPaused

public boolean isPaused()
Returns the paused status for the behavior


addListener

public void addListener(BehaviorListener bl)
Adds a listener for events fired from this behavior, e.g., completion, upon which it will behaviorCompleted();

Invisible:

setType

public void setType(int type)
Invisible:

setRunning

public void setRunning(boolean b)
Invisible:

isRepeating

public boolean isRepeating()
Returns whether the behavior will repeat (indefinately) when finished


setName

public void setName(java.lang.String name)
Sets a (user-assigned) name for this behavior.


getName

public java.lang.String getName()
Returns the user-assigned name for this behavior; Will return the class name if not set by the user.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setId

public void setId(int id)

getId

public int getId()
Returns the unique Id for this behavior


getValue

public float getValue()

findByType

public static java.util.List findByType(int type)
Invisible:

findById

public static RiTextBehavior findById(int id)
Invisible:

findByName

public static RiTextBehavior findByName(java.lang.String name)
Invisible:

setReusable

public void setReusable(boolean reusable)
Invisible:

isReusable

public boolean isReusable()
Invisible: