Slide
Hierarchy
- Transition
- Slide
Index
Constructors
Properties
Accessors
Methods
- addChild
- addComponent
- addTag
- addTemplate
- clearComponents
- clone
- emit
- get
- getAncestors
- getComponents
- getDescendants
- has
- hasAll
- hasAllTags
- hasTag
- isKilled
- kill
- off
- on
- onAdd
- onEnd
- onInitialize
- onPostUpdate
- onPreUpdate
- onPreviousSceneDeactivate
- onRemove
- onReset
- onStart
- onUpdate
- once
- removeAllChildren
- removeChild
- removeComponent
- removeTag
- reset
- unparent
- updateTransition
Constructors
constructor
Parameters
options: TransitionOptions & SlideOptions
Returns Slide
Properties
readonlyblockInput
publicchildrenAdded$
publicchildrenRemoved$
publiccomponentAdded$
publiccomponentRemoved$
publiccomponentValues
publicreadonlycomponents
Current components on the entity
Do not modify
Use addComponent/removeComponent otherwise the ECS will not be notified of changes.
readonlydirection
publicdone
readonlyduration
readonlyeasing
publicevents
Listen to or emit events for an entity
graphics
readonlyhideLoader
publicid
The unique identifier for the entity
publicisActive
Whether this entity is active, if set to false it will be reclaimed
publicname
publicscene
The current scene that the entity is in, if any
readonlyslideDirection
publicstarted
publictagAdded$
publictagRemoved$
transform
Accessors
publicactive
Whether this entity is active, if set to false it will be reclaimed
Returns boolean
Whether this entity is active, if set to false it will be reclaimed
Parameters
val: boolean
Returns void
publicchildren
Get the direct children of this entity
Returns readonly Entity<any>[]
complete
Returns boolean
publicisAdded
Returns boolean
publicisInitialized
Gets whether the actor is Initialized
Returns boolean
publicparent
Returns Entity<any>
progress
Returns a number between [0, 1] indicating what state the transition is in.
- For 'out' direction transitions start at 0 and end at 1
- For 'in' direction transitions start at 1 and end at 0
Returns number
publictags
Specifically get the tags on the entity from TagsComponent
Returns Set<string>
publictypes
The types of the components on the Entity
Returns ComponentCtor[]
Methods
publicaddChild
publicaddComponent
publicaddTag
Adds a tag to an entity
Parameters
tag: string
Returns Entity<any>
publicaddTemplate
publicclearComponents
Returns void
publicclone
Creates a deep copy of the entity and a copy of all its components
Returns Entity<any>
publicemit
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
event: EntityEvents[TEventName]
Returns void
get
Type parameters
- TComponent: Component
Parameters
type: ComponentCtor<TComponent>
Returns MaybeKnownComponent<TComponent, any>
publicgetAncestors
Returns a list of parent entities starting with the topmost parent. Includes the current entity.
Returns Entity<any>[]
publicgetComponents
Returns all component instances on entity
Returns Component[]
publicgetDescendants
Returns a list of all the entities that descend from this entity. Includes the current entity.
Returns Entity<any>[]
publichas
Check if a component type exists
Type parameters
- TComponent: Component
Parameters
type: ComponentCtor<TComponent>
Returns boolean
hasAll
Verifies that an entity has all the required types
Type parameters
- TComponent: Component
Parameters
requiredTypes: ComponentCtor<TComponent>[]
Returns boolean
hasAllTags
Verifies that an entity has all the required tags
Parameters
requiredTags: string[]
Returns boolean
publichasTag
Check if a tag exists on the entity
Parameters
tag: string
name to check for
Returns boolean
publicisKilled
Returns boolean
publickill
Kill the entity, means it will no longer be updated. Kills are deferred to the end of the update. If parented it will be removed from the parent when killed.
Returns void
publicoff
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[TEventName]>
Returns void
publicon
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[TEventName]>
Returns Subscription
publiconAdd
onAdd
is called when Actor is added to scene. This method is meant to be overridden.Synonymous with the event handler
.on('add', (evt) => {...})
Parameters
engine: Engine<any>
Returns void
onEnd
Overridable lifecycle method, called at the end of the transition,
progress
is given between 0 and 1Parameters
progress: number
Returns void
onInitialize
onInitialize
is called before the first update of the entity. This method is meant to be overridden.Synonymous with the event handler
.on('initialize', (evt) => {...})
Parameters
engine: Engine<any>
Returns void
publiconPostUpdate
Safe to override onPostUpdate lifecycle event handler. Synonymous with
.on('postupdate', (evt) =>{...})
onPostUpdate
is called directly after an entity is updated.Parameters
engine: Engine<any>
elapsedMs: number
Returns void
publiconPreUpdate
Safe to override onPreUpdate lifecycle event handler. Synonymous with
.on('preupdate', (evt) =>{...})
onPreUpdate
is called directly before an entity is updated.Parameters
engine: Engine<any>
elapsedMs: number
Returns void
onPreviousSceneDeactivate
Overridable lifecycle method, called right before the previous scene has deactivated.
This gives incoming transition a chance to grab info from previous scene if desired
Parameters
scene: Scene<unknown>
Returns Promise<void>
publiconRemove
onRemove
is called when Actor is added to scene. This method is meant to be overridden.Synonymous with the event handler
.on('remove', (evt) => {...})
Parameters
engine: Engine<any>
Returns void
onReset
Overridable lifecycle method, called when the transition is reset
Use this to override and provide your own reset logic for internal state in custom transition implementations
Returns void
onStart
Overridable lifecycle method, called once at the beginning of the transition
progress
is given between 0 and 1Parameters
progress: number
Returns void
onUpdate
Overridable lifecycle method, called every frame of the transition
progress
is given between 0 and 1Parameters
progress: number
Returns void
publiconce
Type parameters
- TEventName: EventKey<EntityEvents>
Parameters
eventName: TEventName
handler: Handler<EntityEvents[TEventName]>
Returns Subscription
publicremoveAllChildren
Removes all children from this entity
Returns Entity<any>
publicremoveChild
publicremoveComponent
Removes a component from the entity, by default removals are deferred to the end of entity update to avoid consistency issues
Components can be force removed with the
force
flag, the removal is not deferred and happens immediatelyType parameters
- TComponent: Component
Parameters
typeOrInstance: TComponent | ComponentCtor<TComponent>
force: boolean = false
Returns Entity<Exclude<any, TComponent>>
publicremoveTag
Removes a tag on the entity
Removals are deferred until the end of update
Parameters
tag: string
Returns Entity<any>
reset
reset() is called by the engine to reset transitions
Returns void
publicunparent
Unparents this entity, if there is a parent. Otherwise it does nothing.
Returns void
publicupdateTransition
Overridable lifecycle method, called before each update.
WARNING BE SURE to call
super.updateTransition()
if overriding in your own custom implementationParameters
engine: Engine<any>
elapsedMs: number
Returns void
Slide`s between the previous scene and the destination scene
Note: Slide` only works as an "in" transition