Skip to main content

CrossFade

CrossFades between the previous scene and the destination scene

Note: CrossFade only works as an "in" transition

Hierarchy

Index

Constructors

constructor

Properties

publicinherited_componentsToRemove

_componentsToRemove: ComponentCtor[] = []

readonlyinheritedblockInput

blockInput: boolean

publicinheritedchildrenAdded$

childrenAdded$: Observable<Entity<any>> = ...

publicinheritedchildrenRemoved$

childrenRemoved$: Observable<Entity<any>> = ...

publicinheritedcomponentAdded$

componentAdded$: Observable<Component> = ...

publicinheritedcomponentRemoved$

componentRemoved$: Observable<Component> = ...

publicreadonlyinheritedcomponents

components: Map<Function, Component> = ...

Current components on the entity

Do not modify

Use addComponent/removeComponent otherwise the ECS will not be notified of changes.

publicinheritedcomponentValues

componentValues: Component[] = []

readonlyinheriteddirection

direction: in | out

publicinheriteddone

done: Promise<void> = ...

readonlyinheritedduration

duration: number

readonlyinheritedeasing

easing: Easing

engine

engine: Engine

publicinheritedevents

events: EventEmitter<EntityEvents> = ...

Listen to or emit events for an entity

inheritedgraphics

graphics: GraphicsComponent = ...

readonlyinheritedhideLoader

hideLoader: boolean

publicinheritedid

id: number = ...

The unique identifier for the entity

image

image: HTMLImageElement

publicinheritedisActive

isActive: boolean = true

Whether this entity is active, if set to false it will be reclaimed

readonlyinheritedlegacyEasing

legacyEasing: EasingFunction

publicinheritedname

name: string = ...

publicinheritedscene

scene: Scene<unknown> | null = null

The current scene that the entity is in, if any

screenCover

screenCover: Sprite

publicinheritedstarted

started: boolean = false

publicinheritedtagAdded$

tagAdded$: Observable<string> = ...

publicinheritedtagRemoved$

tagRemoved$: Observable<string> = ...

inheritedtransform

transform: TransformComponent = ...

Accessors

publicinheritedactive

  • get active(): boolean
  • set active(val: boolean): void
  • Whether this entity is active, if set to false it will be reclaimed

    @deprecated

    use isActive


    Returns boolean

  • Whether this entity is active, if set to false it will be reclaimed

    @deprecated

    use isActive


    Parameters

    • val: boolean

    Returns void

publicinheritedchildren

  • get children(): readonly Entity<any>[]
  • Get the direct children of this entity


    Returns readonly Entity<any>[]

inheritedcomplete

  • get complete(): boolean
  • Returns boolean

inheriteddistance

  • get distance(): number
  • Returns number

publicinheritedisAdded

  • get isAdded(): boolean
  • Returns boolean

publicinheritedisInitialized

  • get isInitialized(): boolean
  • Gets whether the actor is Initialized


    Returns boolean

publicinheritedparent

  • get parent(): Entity<any> | null
  • Returns Entity<any> | null

inheritedprogress

  • get progress(): number
  • 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

publicinheritedtags

  • get tags(): Set<string>
  • Specifically get the tags on the entity from TagsComponent


    Returns Set<string>

publicinheritedtypes

  • The types of the components on the Entity


    Returns ComponentCtor[]

Methods

publicinheritedaddChild

  • Adds an entity to be a child of this entity


    Parameters

    Returns Entity

publicinheritedaddComponent

  • addComponent<TComponent>(component: TComponent, force?: boolean): Entity<any>
  • Adds a component to the entity


    Type parameters

    Parameters

    • component: TComponent

      Component or Entity to add copy of components from

    • force: boolean = false

      Optionally overwrite any existing components of the same type

    Returns Entity<any>

publicinheritedaddTag

  • addTag(tag: string): Entity<any>
  • Adds a tag to an entity


    Parameters

    • tag: string

    Returns Entity<any>

publicinheritedaddTemplate

  • addTemplate(templateEntity: Entity, force?: boolean): Entity
  • Adds a copy of all the components from another template entity as a "prefab"


    Parameters

    • templateEntity: Entity

      Entity to use as a template

    • force: boolean = false

      Force component replacement if it already exists on the target entity

    Returns Entity

publicinheritedclearComponents

  • clearComponents(): void
  • Returns void

publicinheritedclone

  • Creates a deep copy of the entity and a copy of all its components


    Returns Entity

publicinheritedemit

  • emit<TEventName>(eventName: TEventName, event: EntityEvents[TEventName]): void
  • emit(eventName: string, event?: any): void

inheritedget

publicinheritedgetAncestors

  • Returns a list of parent entities starting with the topmost parent. Includes the current entity.


    Returns Entity<any>[]

publicinheritedgetComponents

  • Returns all component instances on entity


    Returns Component[]

publicinheritedgetDescendants

  • getDescendants(): Entity<any>[]
  • Returns a list of all the entities that descend from this entity. Includes the current entity.


    Returns Entity<any>[]

publicinheritedhas

  • Check if a component type exists


    Type parameters

    Parameters

    Returns boolean

inheritedhasAll

  • hasAll<TComponent>(requiredTypes: ComponentCtor<TComponent>[]): boolean
  • Verifies that an entity has all the required types


    Type parameters

    Parameters

    Returns boolean

inheritedhasAllTags

  • hasAllTags(requiredTags: string[]): boolean
  • Verifies that an entity has all the required tags


    Parameters

    • requiredTags: string[]

    Returns boolean

publicinheritedhasChild

  • hasChild(child: Entity, recursive?: boolean): boolean
  • Check if a child entity exists on the parent entity


    Parameters

    • child: Entity

      entity to check for

    • recursive: boolean = false

      whether to check recursively

    Returns boolean

publicinheritedhasTag

  • hasTag(tag: string): boolean
  • Check if a tag exists on the entity


    Parameters

    • tag: string

      name to check for

    Returns boolean

publicinheritedisKilled

  • isKilled(): boolean
  • Returns boolean

publicinheritedkill

  • kill(): void
  • 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

publicinheritedoff

  • off<TEventName>(eventName: TEventName, handler: Handler<EntityEvents[TEventName]>): void
  • off(eventName: string, handler: Handler<unknown>): void
  • off(eventName: string): void

publicinheritedon

publicinheritedonAdd

  • 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

    Returns void

publicinheritedonce

onEnd

  • onEnd(progress: number): void
  • Overridable lifecycle method, called at the end of the transition,

    progress is given between 0 and 1


    Parameters

    • progress: number

    Returns void

onInitialize

  • onInitialize(engine: Engine): void
  • 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

    Returns void

publicinheritedonPostUpdate

  • onPostUpdate(engine: Engine, elapsed: number): void
  • Safe to override onPostUpdate lifecycle event handler. Synonymous with .on('postupdate', (evt) =>{...})

    onPostUpdate is called directly after an entity is updated.


    Parameters

    Returns void

publicinheritedonPreUpdate

  • onPreUpdate(engine: Engine, elapsed: number): void
  • Safe to override onPreUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})

    onPreUpdate is called directly before an entity is updated.


    Parameters

    Returns void

onPreviousSceneDeactivate

  • onPreviousSceneDeactivate(scene: Scene<unknown>): Promise<void>
  • 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

    Returns Promise<void>

publicinheritedonRemove

  • onRemove(engine: Engine): void
  • onRemove is called when Actor is removed from a scene. This method is meant to be overridden.

    Synonymous with the event handler .on('remove', (evt) => {...})


    Parameters

    Returns void

onReset

  • onReset(): void
  • 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

  • onStart(_progress: number): void
  • Overridable lifecycle method, called once at the beginning of the transition

    progress is given between 0 and 1


    Parameters

    • _progress: number

    Returns void

onUpdate

  • onUpdate(progress: number): void
  • Overridable lifecycle method, called every frame of the transition

    progress is given between 0 and 1


    Parameters

    • progress: number

    Returns void

publicinheritedremoveAllChildren

  • Removes all children from this entity


    Returns Entity

publicinheritedremoveChild

  • Remove an entity from children if it exists


    Parameters

    Returns Entity

publicinheritedremoveComponent

  • removeComponent<TComponent>(typeOrInstance: TComponent | ComponentCtor<TComponent>, force?: boolean): Entity<Exclude<any, TComponent>>
  • 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 immediately


    Type parameters

    Parameters

    • typeOrInstance: TComponent | ComponentCtor<TComponent>
    • force: boolean = false

    Returns Entity<Exclude<any, TComponent>>

publicinheritedremoveTag

  • removeTag(tag: string): Entity<any>
  • Removes a tag on the entity

    Removals are deferred until the end of update


    Parameters

    • tag: string

    Returns Entity<any>

inheritedreset

  • reset(): void
  • reset() is called by the engine to reset transitions


    Returns void

publicinheritedunparent

  • unparent(): void
  • Unparents this entity, if there is a parent. Otherwise it does nothing.


    Returns void

publicinheritedupdateTransition

  • updateTransition(engine: Engine, elapsed: number): void
  • Overridable lifecycle method, called before each update.

    WARNING BE SURE to call super.updateTransition() if overriding in your own custom implementation


    Parameters

    Returns void