Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sprite

2D 基础图形 TODO: 仿射变换应该加在这一层

Hierarchy

Index

Constructors

Properties

_hasChange: boolean
inner
_listeners: Map<string, TinoeEventListener[]>
children: Sprite[]
graphics: Graphics
name: string
parent: Sprite
uuid: string

Methods

  • 添加子节点

    Parameters

    Returns void

  • 删除子节点

    Parameters

    Returns void

  • addChildren(...children: Sprite[]): void
  • 添加1~n个子节点

    Parameters

    • Rest ...children: Sprite[]

      待添加节点

    Returns void

  • addEventListener(type: string, handler: ((data: any) => any), once?: boolean): void
  • 注册handler

    memberof

    EventEmitter

    Parameters

    • type: string
    • handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • destroy(): void
  • 销毁

    Returns void

  • dispatch(type: string, data?: any): void
  • 派发事件

    memberof

    EventEmitter

    Parameters

    • type: string
    • Optional data: any

    Returns void

  • fromImage(url: string): Promise<void>
  • Parameters

    • url: string

    Returns Promise<void>

  • fromTexture(x: number, y: number, width: number, height: number, tex: Texture): void
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number
    • tex: Texture

    Returns void

  • getChildByName(name: string, findAll?: boolean): Node<Node<any>>[] | Sprite
  • 根据name标识查找子节点

    Parameters

    • name: string

      标识

    • Optional findAll: boolean

      是否查找所有符合name标识的节点

    Returns Node<Node<any>>[] | Sprite

    查找到的节点

  • off(type?: string, handler?: ((data: any) => any)): void
  • 注销事件

    memberof

    EventEmitter

    Parameters

    • Optional type: string
    • Optional handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    Returns void

    {void}

  • on(type: string, handler: ((data: any) => any), once?: boolean): void
  • 注册handler

    memberof

    EventEmitter

    Parameters

    • type: string
    • handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • removeChildren(...children: Sprite[]): void
  • 删除1~n个字节点

    Parameters

    • Rest ...children: Sprite[]

      待删除节点

    Returns void

  • removeEventListener(type?: string, handler?: ((data: any) => any), once?: boolean): void
  • 注销handler

    memberof

    EventEmitter

    Parameters

    • Optional type: string
    • Optional handler: ((data: any) => any)
        • (data: any): any
        • Parameters

          • data: any

          Returns any

    • Optional once: boolean

    Returns void

  • removeFromParent(): void
  • traverse(callback: ((n: Sprite) => void), isIncludingSelf?: boolean): void
  • 遍历节点

    Parameters

    • callback: ((n: Sprite) => void)

      回调函数

    • Optional isIncludingSelf: boolean

      自己是否执行回调函数,默认为true

    Returns void

Generated using TypeDoc