Class CAAT.Foundation.UI.TextActor
Extends
CAAT.Foundation.Actor.
Defined in: TextActor.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
a boolean indicating whether the text should be filled.
|
|
a valid canvas rendering context font description.
|
|
Font info.
|
|
text's stroke line width.
|
|
a boolean indicating whether the text should be outlined.
|
|
a valid color description string.
|
|
a CAAT.PathUtil.Path which will be traversed by the text.
|
|
time to be taken to traverse the path.
|
|
A CAAT.Behavior.Interpolator to apply to the path traversal.
|
|
traverse the path forward (1) or backwards (-1).
|
|
a string with the text to draw.
|
|
a valid canvas rendering context textAlign string.
|
|
a valid canvas rendering context textBaseLine string.
|
|
text fill color
|
|
calculated text height in pixels.
|
|
calculated text width in pixels.
|
- Fields borrowed from class CAAT.Foundation.Actor:
- __super, AABB, alpha, backgroundImage, behaviorList, cached, clip, clipPath, dirty, discardable, duration, expired, fillStyle, frameAlpha, gestureEnabled, glEnabled, height, id, inFrame, invalid, isAA, isCachedActor, isGlobalAlpha, lifecycleListenerList, minimumSize, modelViewMatrix, modelViewMatrixI, mouseEnabled, oldX, oldY, parent, pointed, preferredSize, preventLayout, rotationAngle, rotationX, rotationY, scaleAnchor, scaleTX, scaleTY, scaleX, scaleY, size_active, size_total, start_time, strokeStyle, tAnchorX, tAnchorY, time, viewVertices, visible, wdirty, width, worldModelViewMatrix, worldModelViewMatrixI, x, y
Method Attributes | Method Name and Description |
---|---|
<private> | |
<private> |
__init()
|
<private> | |
calcTextSize(director)
Calculates the text dimension in pixels and stores the values in textWidth and textHeight
attributes.
|
|
centerAt(x, y)
|
|
drawOnPath(director, time)
Private.
|
|
drawSpriteText(director, time)
Private.
|
|
drawSpriteTextOnPath(director, time)
Private.
|
|
paint(director, time)
Custom paint method for TextActor instances.
|
|
setAlign(align)
Sets text alignment
|
|
setBaseline(baseline)
|
|
setBounds(x, y, w, h)
|
|
setFill(fill)
Set the text to be filled.
|
|
setFont(font)
Sets the font to be applied for the text.
|
|
setLineWidth(lw)
|
|
setLocation(x, y)
|
|
setOutline(outline)
Sets whether the text will be outlined.
|
|
setOutlineColor(color)
Defines text's outline color.
|
|
setPath(path, interpolator, duration)
Set the path, interpolator and duration to draw the text on.
|
|
setPathTraverseDirection(direction)
|
|
setPosition(x, y)
|
|
setSize(w, h)
|
|
setText(sText)
Set the text to be shown by the actor.
|
|
setTextAlign(align)
|
|
setTextBaseline(baseline)
Set text baseline.
|
|
setTextFillStyle(style)
|
- Methods borrowed from class CAAT.Foundation.Actor:
- __paintActor, __scale1To, __validateLayout, addAnimation, addBehavior, addListener, animate, cacheAsBitmap, centerOn, clean, contains, create, destroy, disableDrag, drawScreenBoundingBox, emptyBehaviorList, enableDrag, enableEvents, endAnimate, findActorAtPosition, findActorById, fireEvent, gestureChange, gestureEnd, gestureStart, getAnchor, getAnchorPercent, getBehavior, getId, getMinimumSize, getPreferredSize, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, invalidateLayout, isCached, isGestureEnabled, isInAnimationFrame, isVisible, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, moveTo, paintActor, paintActorGL, playAnimation, removeBehaviorById, removeBehaviour, removeListener, resetAnimationTime, resetAsButton, resetTransform, rotateTo, scaleTo, scaleXTo, scaleYTo, setAlpha, setAnimationEndCallback, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setButtonImageIndex, setCachedActor, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setGlobalAnchor, setId, setImageTransformation, setMinimumSize, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setPositionAnchor, setPositionAnchored, setPreferredSize, setPreventLayout, setRotation, setRotationAnchor, setRotationAnchored, setScale, setScaleAnchor, setScaleAnchored, setScreenBounds, setSpriteIndex, setStrokeStyle, setUV, setVisible, stopCacheAsBitmap, touchEnd, touchMove, touchStart, viewToModel
Field Detail
fill
a boolean indicating whether the text should be filled.
font
a valid canvas rendering context font description. Default font will be "10px sans-serif".
fontData
Font info. Calculated in CAAT.
lineWidth
text's stroke line width.
outline
a boolean indicating whether the text should be outlined. not all browsers support it.
outlineColor
a valid color description string.
path
a CAAT.PathUtil.Path which will be traversed by the text.
pathDuration
time to be taken to traverse the path. ms.
pathInterpolator
A CAAT.Behavior.Interpolator to apply to the path traversal.
sign
traverse the path forward (1) or backwards (-1).
text
a string with the text to draw.
textAlign
a valid canvas rendering context textAlign string. Any of:
start, end, left, right, center.
defaults to "left".
textBaseline
a valid canvas rendering context textBaseLine string. Any of:
top, hanging, middle, alphabetic, ideographic, bottom.
defaults to "top".
textFillStyle
text fill color
textHeight
calculated text height in pixels.
textWidth
calculated text width in pixels.
Method Detail
<private>
__calcFontData()
<private>
__init()
<private>
__setLocation()
calcTextSize(director)
Calculates the text dimension in pixels and stores the values in textWidth and textHeight
attributes.
If Actor's width and height were not set, the Actor's dimension will be set to these values.
- Parameters:
- director
- a CAAT.Director instance.
- Returns:
- this
centerAt(x, y)
- Parameters:
- x
- y
drawOnPath(director, time)
Private.
Draw the text traversing a path.
- Parameters:
- director
- a valid CAAT.Director instance.
- time
- an integer with the Scene time the Actor is being drawn.
drawSpriteText(director, time)
Private.
Draw the text using a sprited font instead of a canvas font.
- Parameters:
- director
- a valid CAAT.Director instance.
- time
- an integer with the Scene time the Actor is being drawn.
drawSpriteTextOnPath(director, time)
Private.
Draw the text traversing a path using a sprited font.
- Parameters:
- director
- a valid CAAT.Director instance.
- time
- an integer with the Scene time the Actor is being drawn.
paint(director, time)
Custom paint method for TextActor instances.
If the path attribute is set, the text will be drawn traversing the path.
- Parameters:
- director
- a valid CAAT.Director instance.
- time
- an integer with the Scene time the Actor is being drawn.
setAlign(align)
Sets text alignment
- Parameters:
- align
- Deprecated:
- use setTextAlign
setBaseline(baseline)
- Parameters:
- baseline
setBounds(x, y, w, h)
- Parameters:
- x
- y
- w
- h
setFill(fill)
Set the text to be filled. The default Filling style will be set by calling setFillStyle method.
Default value is true.
- Parameters:
- fill
- {boolean} a boolean indicating whether the text will be filled.
- Returns:
- this;
setFont(font)
Sets the font to be applied for the text.
- Parameters:
- font
- a string with a valid canvas rendering context font description.
- Returns:
- this
setLineWidth(lw)
- Parameters:
- lw
setLocation(x, y)
- Parameters:
- x
- y
setOutline(outline)
Sets whether the text will be outlined.
- Parameters:
- outline
- {boolean} a boolean indicating whether the text will be outlined.
- Returns:
- this;
setOutlineColor(color)
Defines text's outline color.
- Parameters:
- color
- {string} sets a valid canvas context color.
- Returns:
- this.
setPath(path, interpolator, duration)
Set the path, interpolator and duration to draw the text on.
- Parameters:
- path
- a valid CAAT.Path instance.
- interpolator
- a CAAT.Interpolator object. If not set, a Linear Interpolator will be used.
- duration
- an integer indicating the time to take to traverse the path. Optional. 10000 ms by default.
setPathTraverseDirection(direction)
- Parameters:
- direction
setPosition(x, y)
- Parameters:
- x
- y
setSize(w, h)
- Parameters:
- w
- h
setText(sText)
Set the text to be shown by the actor.
- Parameters:
- sText
- a string with the text to be shwon.
- Returns:
- this
setTextAlign(align)
- Parameters:
- align
setTextBaseline(baseline)
Set text baseline.
- Parameters:
- baseline
setTextFillStyle(style)
- Parameters:
- style