RiTa
index
Name RiText
Description The basic utility object for strings of text and associated features. Contains a variety of utility methods for typography and display, animation, text-to-speech, and audio playback. An example usage:
    import rita.*;

    void setup() {
      // start in the upper left corner
      RiText rt = new RiText(this, "hello", 0, 10);

      // measure the width of the text
      float tw = rt.textWidth();

      // move to the lower right in 2 sec
      rt.moveTo(width-tw, height, 2);

    }
    void draw() {
      // draw the bg every frame
      background(255);
    }
Constructors
RiText(parent);
RiText(parent, image, startXPos, startYPos);
RiText(parent, image);
RiText(parent, text);
RiText(parent, character);
RiText(parent, startXPos, startYPos);
RiText(parent, text, startXPos, startYPos);
RiText(parent, text, xPos, yPos, alignment);
Fields
sample   Current Sample object for this text

Methods
addBehavior()   Add a new Behavior to the RiText's run queue

addFeature()   Adds a feature (a key-value pair) to the RiText.

align()   Sets text mode for this RiText object.

boundingBoxFill()   Set the bounding-box (or background) color for this object

boundingBoxPadding()   Sets min padding (in pixels) around all sides of text in bounding box (default=1)

boundingBoxSelectedFill()   Set the current boundingBoxFill color for this object, applicable only when showBoundingBox(true) has been called.

boundingBoxSelectedStroke()   Set the selected boundingBoxStroke color for this object, applicable only when showBoundingBox(true) has been called.

boundingBoxStroke()   Set the stroke color for the bounding-box of this object, assuming is has been set to visible.

boundingBoxStrokeWeight()   Set the current bgstroke weight for this object

charAt()   Returns the character at the specified index

clearFeatures()   Clears all the features (key-value pairs) for the RiText

contains()   Checks if the input point is inside the bounding box

contains3D()   Checks if the input point is inside the object's bounding box after converting its x,y,z coordinates to screen x & y.

fadeColor()  

fadeIn()   Fades in the current text over seconds starting at startTime

fadeOut()   Fades out current text over seconds starting at startTime

fadeToText()   Fades out the current text and fades in the newText over seconds starting immediately

fill()   Set the text fill for this object (same as setColor())

fillHex()   Takes a String

firstIndexOf()   Returns the index of the first token matching word or -1 if not found

getAlpha()   Returns the fill alpha value (transparency)

getAvailableFeatures()   Returns a Set of all the available feature keys for the RiText

getBoundingBox()   Returns a new bounding box object (Rectangle2D.Float) representing the current screen position

getBoundingBoxFill()   Returns the current bounding box fill color for this object

getBoundingBoxStroke()   Returns the current bounding box stroke color for this object

getColor()   Returns the current text color for this object

getFeature()   Returns the String value for the given feature

getFeatures()   Returns a Map of all the features (key-value pairs) exists for this RiText

getFont()   Return the current font for this object

getImageHeight()   Returns the height of the image associated with this RiText

getImageWidth()   Returns the width of the image associated with this RiText

getLiveBehaviorCount()   Returns the # of running (non-completed) Behaviors in the RiText's run queue

getMotionType()   Returns the motionType for this object,

getPos()   Returns the part-of-speech for either the whole phrase or the first instance of word in the text, using the default WordTokenizer & PosParser, or null if the word is not found.

getPosAt()   Returns the part-of-speech at wordIdx using the default WordTokenizer & PosParser...

getPosition()   returns a 3-dimensional array with the objects x,y,z position

getPosStr()   Returns an String of part-of-speech tags, 1 per word, using the default WordTokenizer & PosParser, delimited by delim.

getSample()   Returns the RiSample object associated with this RiText

getSelectedColor()   Returns the fill color for this object when it is selected

getText()   Returns the current text

getTextAlignment()   Returns the current alignment (default=LEFT)

getWordAt()   Returns the word at wordIdx using the default WordTokenizer.

getWordCount()   Returns the # of words in the object according to the default WordTokenizer

getWordOffset()   Returns the pixel x-offset for the given word index.

Useful, for example, to determine the starting positions of new RiTexts after a split() operation

getWordOffsetWith()   Returns the pixel x-offset for the given word index using the given font

Useful, for example, to determine the starting positions of new RiTexts after a split() operation

getWords()   Returns the array of words tokenized by the default WordTokenizer

getX()   Gets the current x-position of the RiText

getY()   Gets the current y-position of the RiText

hasFeature()   Checks whether the named feature (key-value pair) exists for this RiText

imageContains()   Checks if the input point is inside the bounding box

indexOf()   Returns the indexes of all tokens matching word or null if none are found

insertWordAt()   Inserts newWord at wordIdx and shifts each subsequent word accordingly. Returns true if the replace was succesful, or false if the index does not exist.

isBoundingBoxVisible()   Returns the visibility of the objects bounding box (default=false)

isMouseDraggable()   Returns true if the object has been set to be draggable by the mouse

isOffscreen()   Returns true if the object is offscreen

isSelected()   Returns whether the object is currently selected.

isVisible()   Returns true if the objects is not hidden

lastIndexOf()   Returns the index of the last token matching word or -1 if not found

length()   Returns number of characters in the contained String

loadFont()   Loads and returns the font specified after setting the current font size.

loadSample()   Loads a sample file and returns the appropriate type of RiSample object according to the library specified in playerType (defaults to Minim).

moveBy()  

moveBy3D()   Move to new position by x,y,z offset over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

moveTo()  

moveTo3D()  

pauseBehaviors()   Pauses (or unpauses) all Behaviors in the RiText's run queue

removeBehavior()   Remove a Behavior from the RiText's run queue

removeBehaviors()   Remove all Behaviors from the RiText's run queue

removeFeature()   Clears the entry for the named feature (a key-value pair)

replace()   Replaces all instances of oldText with newText in the object.

replaceByPos()   Randomly chooses from all words matching pos and replaces a random one with newWord. Returns the replaced word or null if if no substitution could be made.

replaceFirst()   Replaces first instance of oldText with newText in the object.

replaceWordAt()   Replaces the word at wordIdx with newWord. Returns true if the replace was succesful, or false if the index does not exist.

scaleImage()   Scales the bg image by scalePercent

setAlpha()   Set the current alpha trasnparency for this object (0-255))

setColor()   Set the text color for this object

setFeatures()   Replaces all the features (key-value pairs) for the RiText with those in features

setImage()   Sets the bg image for the object

setImageHeight()   Sets height for the bg {@link #image}

setImageOffset()   Sets the relative position of the bgImage

setImageVisible()   Sets the relative position of the bgImage

setImageWidth()   Sets width for the bg {@link #image}

setLocation()   Sets the location of the current RiText

setMotionType()   Sets the animation motionType for this for moveTo or moveBy() methods on this object, set via one of the following constants:
  • RiText.LINEAR
  • RiText.EASE_IN
  • RiText.EASE_OUT
  • RiText.EASE_IN_OUT
  • RiText.EASE_IN_OUT_CUBIC
  • RiText.EASE_IN_CUBIC
  • RiText.EASE_OUT_CUBIC;
  • RiText.EASE_IN_OUT_QUARTIC
  • RiText.EASE_IN_QUARTIC
  • RiText.EASE_OUT_QUARTIC;
  • RiText.EASE_IN_OUT_SINE
  • RiText.EASE_IN_SINE
  • RiText.EASE_OUT_SINE


setMouseDraggable()   Sets the object's draggable state (default=false)

setSelected()   Manually sets the objects 'selected' field

setSelectedColor()   Set the fill color for this object when selected

setText()   Sets the current text to this String

setVisible()   Sets boolean flag to show or hide the object

setX()   Sets the x-position of the current RiText

setY()   Sets the y-position of the current RiText

showBoundingBox()   Sets the visibility of the objects bounding box (default=false)

split()   Splits this object into an array of RiTexts, one per word, with correct x-positions

subSequence()   Returns a new character sequence that is a subsequence of this sequence.

An invocation of this method of the form

 str.subSequence(begin, end)
behaves in exactly the same way as the invocation
 str.substring(begin, end)


textFont()   Sets the font and size for this object's text

textHeight()   Returns the current text height in pixels

textMode()   Sets text mode for RiText object.

textSize()   Sets the object to this size

textWidth()   Returns the current text width in pixels

RiText.clearSelected()   Clears the selected flag for all RiTexts

RiText.copy()   Returns a field for field copy of this object

RiText.createDefaultFont()   Sets the default font for all RiTexts to be created (via Papplet.createFont(String))

RiText.createLines()   Creates an array of RiText, one per line of input text, constrained to the maxChars specified, starting with upper left corner at startX and startY or null if null or empty input

RiText.createLinesFromFile()  

RiText.createWords()  

RiText.delete()   Deletes all objects in the array (and the array itself)

RiText.deleteAll()   Deletes all current instances.

RiText.disableAutoDraw()   Disables auto-drawing of subsequently created RiTexts.
Note: draw() must be explicitly called on these objects.

RiText.drawAll()   Draws all (visible) RiText objects

RiText.fadeAllIn()   Fades in all RiText objects over the specified duration

RiText.fadeAllOut()   Fades all visible RiText objects.

RiText.getInstances()   Returns all existing instances of RiText objects in an array

RiText.getNumInstances()   Returns the number of existing RiTexts

RiText.getPicked()   Returns all RiTexts that contain the point x,y or null if none do.

RiText.getSelected()   Returns all selected RiTexts or null if none are selected

RiText.loadStrings()   Creates an array of RiText from a file, by delegating to PApplet.loadStrings(), then creating one array element per line (including blanks).

RiText.loopSample()   Static convenience method that loads a RiSample object and starts it looping. Note: The returned RiSample object is not associated with any particular RiText object.

RiText.pauseAllBehaviors()   Immediately pauses all Behaviors in the RiText's run queue

RiText.regexMatch()   Utility method to test whether a String partially matches a regex pattern.

RiText.regexReplace()   Utility method to do regex replacement on a String

RiText.setDefaultAlignment()   Sets the default alignment for all RiTexts to be created. This does not affect already created RiText objects - for this, use textMode().

RiText.setDefaultBoundingBoxStrokeWeight()   Set the bounding box strokeweight for all existing RiTexts; set to 0 if you wish to assign a background color with no stroke.

RiText.setDefaultBoundingBoxVisibility()   Sets the default behavior regarding whether newly created RiTexts are to display their bounding boxes
Note: this does not affect already created RiText objects

RiText.setDefaultColor()   Sets the default color for all RiTexts to be created. This does not affect already created RiText objects.

RiText.setDefaultFont()   Sets the default font for all RiTexts to be created (via Papplet.loadFont(String))

RiText.setDefaultMotionType()   Sets the default motion type for all RiTexts to be created. This does not affect already created RiText objects - for this, use setMotionType().

RiText.setDefaultMouseDraggable()   Sets the default behavior regarding whether newly created RiTexts are to be mouse-draggable
Note: this does not affect already created RiText objects

RiText.setFont()   Sets font for all existing RiText objects.

RiText.setFontSize()   Sets default text size for all existing objects.

RiText.setTextAlignment()   Sets alignment for all existing objects

Usage Web & Application