Class: AnimatedSprite
Hierarchy
-
↳
AnimatedSprite
Constructors
constructor
• new AnimatedSprite(data
, resourceBase
, layout
, parentElement
, options
): AnimatedSprite
Parameters
Name | Type |
---|---|
data |
AnimatedSprite |
resourceBase |
string |
layout |
LayoutInstance |
parentElement |
Element |
options |
LayoutCreateOptions |
Returns
Overrides
Properties
activeData
• activeData: AnimatedSprite
Overrides
activeState
• activeState: string
Inherited from
alpha
• Protected
alpha: number
Inherited from
children
• Optional
children: Element
[]
Inherited from
contentSize
• Private
contentSize: Size
data
• data: AnimatedSprite
Overrides
dirtyFlag
• Protected
dirtyFlag: DirtyFlag
Inherited from
eventCancels
• Optional
eventCancels: Record
<string
, () => void
[]>
Inherited from
filters
• Protected
filters: null
| Filter
[]
Inherited from
flip
• Protected
flip: number
Inherited from
flipMatrix
• Private
flipMatrix: null
| Matrix
isVisible
• Protected
isVisible: boolean
Inherited from
layout
• layout: LayoutInstance
Inherited from
mask
• Protected
mask: null
| Element
Inherited from
name
• name: string
Inherited from
parent
• parent: null
| Element
Inherited from
pixiAnimatedSprite
• pixiAnimatedSprite: null
| AnimatedSprite
pixiDebug
• pixiDebug: null
| Graphics
Inherited from
size
• Protected
size: Size
Inherited from
transform
• Protected
transform: default
Inherited from
DEBUG_ALPHA
▪ Static
DEBUG_ALPHA: number
= 0.5
Inherited from
DEBUG_COLOR
▪ Static
DEBUG_COLOR: number
= 0xff0000
Inherited from
isMute
▪ Static
isMute: boolean
= false
Inherited from
Accessors
cacheAsBitmap
• get
cacheAsBitmap(): boolean
Returns
boolean
Inherited from
Element.cacheAsBitmap
• set
cacheAsBitmap(value
): void
Parameters
Name | Type |
---|---|
value |
boolean |
Returns
void
Inherited from
Element.cacheAsBitmap
Methods
adjust
▸ adjust(realScreenSize
, logicalScreenSize
, parentSize
, parentOffset?
): void
Parameters
Name | Type |
---|---|
realScreenSize |
Size |
logicalScreenSize |
Size |
parentSize |
Size |
parentOffset? |
Size |
Returns
void
Inherited from
adjustChildren
▸ adjustChildren(realScreenSize
, logicalScreenSize
, nodeSize
): void
Parameters
Name | Type |
---|---|
realScreenSize |
Size |
logicalScreenSize |
Size |
nodeSize |
Size |
Returns
void
Inherited from
adjustHierarchy
▸ adjustHierarchy(container
, offset
): number
Parameters
Name | Type |
---|---|
container |
Container <DisplayObject > |
offset |
number |
Returns
number
Inherited from
animate
▸ animate(state
, animateStart
, animateEnd
, instant
): null
| Node
Parameters
Name | Type |
---|---|
state |
string |
animateStart |
() => void |
animateEnd |
() => void |
instant |
boolean |
Returns
null
| Node
Inherited from
cancelLocalEvent
▸ cancelLocalEvent(eventName
): boolean
Parameters
Name | Type |
---|---|
eventName |
string |
Returns
boolean
Inherited from
createChildren
▸ createChildren(create
, options
): void
Parameters
Name | Type |
---|---|
create |
(data : Node , options : LayoutCreateOptions ) => Element |
options |
LayoutCreateOptions |
Returns
void
Inherited from
destroy
▸ destroy(): void
Returns
void
Overrides
destroySprite
▸ destroySprite(): void
Returns
void
dirty
▸ dirty(flag
, recursive?
): void
Mark the element as dirty. When the element is marked DIRTY
the layout will be marked as
requiring adjustment and all the parents of the element will be marked as CHILD_DIRTY
unless they are already DIRTY
.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
flag |
DirtyFlag |
undefined |
The dirty flag to set for the element |
recursive |
boolean |
true |
If disabled the flag will only be set for this element |
Returns
void
Inherited from
getContentSize
▸ getContentSize(): Size
Returns
Overrides
getDebugTitle
▸ getDebugTitle(): string
Returns
string
Inherited from
getDirty
▸ getDirty(): DirtyFlag
Get the current dirty status of the element.
Returns
Inherited from
getMask
▸ getMask(): null
| Element
Returns
null
| Element
Inherited from
getNode
▸ getNode(this
, matcher
): undefined
| Element
Returns the first node from the hierarchy, including this one, that matches the filtering options.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
matcher |
Matcher <Element > |
Filtering options |
Returns
undefined
| Element
Inherited from
▸ getNode(this
, filter
): undefined
| Element
Returns the first node from the hierarchy, including this one, whose name matches the provided filter.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
undefined
| Element
Inherited from
▸ getNode<T2
>(this
, type
): undefined
| T2
Returns the first node from the hierarchy, including this one, whose type matches the provided type.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
Returns
undefined
| T2
Inherited from
▸ getNode<T2
>(this
, type
, filter
): undefined
| T2
Returns the first node from the hierarchy, including this one, whose type matches the provided type and name matches the provided filter.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
undefined
| T2
Inherited from
getPixiObject
▸ getPixiObject(): null
| AnimatedSprite
Returns
null
| AnimatedSprite
Overrides
isWorldVisible
▸ isWorldVisible(): boolean
Check whether the element is visible or not. Because of the hierarchy optimizations it is
not possible to use DisplayObject.worldVisible
to check for the visibility as non-visible
nodes will still have the old parent reference.
Returns
boolean
Inherited from
localEvent
▸ localEvent(states
, params?
): Promise
<void
>
Parameters
Name | Type |
---|---|
states |
string | Event [] |
params? |
EventParams |
Returns
Promise
<void
>
Inherited from
match
▸ match(this
, «destructured»
): boolean
Test node type and/or name for a match.
Parameters
Name | Type |
---|---|
this |
Element |
«destructured» |
Matcher <Element > |
Returns
boolean
Inherited from
nodes
▸ nodes(this
): Generator
<Element
, any
, unknown
>
Iterate over all nodes in the hierarchy, including this one.
Parameters
Name | Type |
---|---|
this |
Element |
Returns
Generator
<Element
, any
, unknown
>
Inherited from
▸ nodes(this
, matcher
): Generator
<Element
, any
, unknown
>
Iterate over all nodes in the hierarchy, including this one. Can optionally filter the nodes based on type and/or name.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
matcher |
Matcher <Element > |
Filtering options |
Returns
Generator
<Element
, any
, unknown
>
Inherited from
▸ nodes(this
, filter
): Generator
<Element
, any
, unknown
>
Iterate over all nodes in the hierarchy, including this one. The iterator skips nodes whose name does not match the provided filter.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
Generator
<Element
, any
, unknown
>
Inherited from
▸ nodes<T2
>(this
, type
): Generator
<T2
, any
, unknown
>
Iterate over all nodes in the hierarchy, including this one. The iterator skips nodes whose type does not match the provided type.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
Returns
Generator
<T2
, any
, unknown
>
Inherited from
▸ nodes<T2
>(this
, type
, filter
): Generator
<T2
, any
, unknown
>
Iterate over all nodes in the hierarchy, including this one. The iterator skips nodes whose type does not match the provided type or name does not match the provided filter.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
Generator
<T2
, any
, unknown
>
Inherited from
offClick
▸ offClick(): void
Unregister the previously registered click handler. It is safe to call this even when no click handler is registered.
Returns
void
Inherited from
offDrag
▸ offDrag(): void
Unregister the previously registered drag handler. It is safe to call this even when no drag handler is registered.
Returns
void
Inherited from
offHover
▸ offHover(): void
Unregister a previously registered hover handler. It is safe to call this even when no hover handler is registered.
If the cursor is hovering on the element when offHover
is called the leave state will be
triggered to reset the visual states. However the registered leave callback will not be
called.
Returns
void
Inherited from
onClick
▸ onClick<T
>(this
, callback
, eventParams?
): void
Register a click handler with a callback. If the element data has a click
trigger an event
with that name will be automatically triggered when the callback is called. If a click
handler has already been registered it will be cleared with a warning.
Type parameters
Name | Type |
---|---|
T |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
T |
- |
callback |
ClickCallback <T > |
The callback to call when the element is clicked |
eventParams? |
EventParams |
Optional event parameters for the click event |
Returns
void
Inherited from
onDrag
▸ onDrag<T
>(this
, callback?
): void
Register a drag handler with a callback. Whether the element dragging acts as scroll or drag
is determined by the dragX
and dragY
settings in the trigger data. By default the
callback is called with the drag offset but if dragStepsX
or dragStepsY
is enabled the
value will be the index of the step for the respective axis. If a drag handler has already
been registered it will be cleared with a warning.
Type parameters
Name | Type |
---|---|
T |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
T |
- |
callback? |
DragCallback <T > |
Optional callback to call when the element is dragged |
Returns
void
Inherited from
onHover
▸ onHover<T
>(this
, callbacks?
): void
Register a hover handler with enter and leave callbacks. If the element data has
hoverEnter
or hoverLeave
triggers the corresponding states will be automatically set
when the callbacks are called. If a hover handler has already been registered it will be
cleared with a warning.
Type parameters
Name | Type |
---|---|
T |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
T |
- |
callbacks? |
Partial <HoverCallbacks <T >> |
Optional callbacks to call when the cursor enters or leaves the element |
Returns
void
Inherited from
registerStates
▸ registerStates(register
): void
Parameters
Name | Type |
---|---|
register |
(state : string ) => void |
Returns
void
Inherited from
requireNode
▸ requireNode(this
, matcher
): Element
Returns the first node from the hierarchy, including this one, that matches the filtering options. Throws an error if the node is not found.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
matcher |
Matcher <Element > |
Filtering options |
Returns
Inherited from
▸ requireNode(this
, filter
): Element
Returns the first node from the hierarchy, including this one, whose name matches the provided filter. Throws an error if the node is not found.
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
Inherited from
▸ requireNode<T2
>(this
, type
): T2
Returns the first node from the hierarchy, including this one, whose type matches the provided type. Throws an error if the node is not found.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
Returns
T2
Inherited from
▸ requireNode<T2
>(this
, type
, filter
): T2
Returns the first node from the hierarchy, including this one, whose type matches the provided type and name matches the provided filter. Throws an error if the node is not found.
Type parameters
Name | Type |
---|---|
T2 |
extends Element |
Parameters
Name | Type | Description |
---|---|---|
this |
Element |
- |
type |
Type <T2 > |
Type for filtering the nodes |
filter |
Filter |
String or RegExp for filtering the nodes |
Returns
T2
Inherited from
resetTextures
▸ resetTextures(): void
Returns
void
setDebug
▸ setDebug(debug
): void
Parameters
Name | Type |
---|---|
debug |
boolean |
Returns
void
Inherited from
setDragOffset
▸ setDragOffset(offset
, duration?
, easing?
): Promise
<void
>
Set drag offset. By default the offset is set instantly but a transition effect can be enabled by providing duration and an easing function.
The returned promise resolves once the target offset is reached, or if another
setDragOffset
call or manual dragging interrupts the transition.
Parameters
Name | Type | Description |
---|---|---|
offset |
Size |
Offset in logical screen coordinates or snap steps |
duration? |
number |
Duration of the transition in seconds |
easing? |
Easing |
Easing function for the transition |
Returns
Promise
<void
>
Inherited from
setLocalState
▸ setLocalState(state
, options?
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
state |
string |
options? |
Object |
options.instant? |
boolean |
options.skipChildren? |
boolean |
options.validate? |
boolean |
Returns
Promise
<boolean
>
Inherited from
setMask
▸ setMask(mask
): void
Parameters
Name | Type |
---|---|
mask |
Element |
Returns
void
Inherited from
setState
▸ setState(state
, animateStart
, animateEnd
, instant
, recursive?
): boolean
Parameters
Name | Type | Default value |
---|---|---|
state |
string |
undefined |
animateStart |
() => void |
undefined |
animateEnd |
() => void |
undefined |
instant |
boolean |
undefined |
recursive |
boolean |
true |
Returns
boolean
Inherited from
setTextures
▸ setTextures(textures
): void
Parameters
Name | Type |
---|---|
textures |
null | Texture <Resource >[] |
Returns
void
updateAlpha
▸ updateAlpha(alpha
, parentAlpha
): boolean
Parameters
Name | Type |
---|---|
alpha |
number |
parentAlpha |
number |
Returns
boolean
Inherited from
updateInteractions
▸ updateInteractions(group
): void
Parameters
Name | Type |
---|---|
group |
GroupContainer |
Returns
void
Inherited from
updatePixiObject
▸ updatePixiObject(realScreenSize
, logicalScreenSize
, transform
, size
, flip
, alpha
): void
Parameters
Name | Type |
---|---|
realScreenSize |
Size |
logicalScreenSize |
Size |
transform |
Transform |
size |
Size |
flip |
number |
alpha |
number |
Returns
void
Overrides
updateStateCache
▸ updateStateCache(): void
Returns
void
Inherited from
collectResources
▸ collectResources(data
, resourceBase
, resources
): void
Parameters
Name | Type |
---|---|
data |
AnimatedSprite |
resourceBase |
string |
resources |
Resource [] |
Returns
void
Overrides
setDebugColor
▸ setDebugColor(debugColor
, debugAlpha?
): void
Parameters
Name | Type | Default value |
---|---|---|
debugColor |
number |
undefined |
debugAlpha |
number |
1 |
Returns
void
Inherited from
setGlobalMute
▸ setGlobalMute(isMute
): void
Parameters
Name | Type |
---|---|
isMute |
boolean |
Returns
void