Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Transform2D

Hierarchy

Index

Constructors

constructor

  • new Transform2D(entity: Entity2D, _rawNativeValue?: Float32Array): Transform2D
  • 请使用engine.game.createEntity2D(name)创建2D对象

    memberof

    Transform2D

    Parameters

    • entity: Entity2D
    • Optional _rawNativeValue: Float32Array

    Returns Transform2D

Events

onDeserialized

  • onDeserialized(data: any): void
  • Parameters

    • data: any

    Returns void

Properties

Readonly entity

entity: Entity2D

Readonly id

id: number = ...

Readonly isDestroyed

isDestroyed: boolean = false

Readonly isDestroying

isDestroying: boolean = false

Readonly priority

priority: number = ...

Static Readonly OFFSETS

OFFSETS: Readonly<{ LOCALANCHOR: number; LOCALMATRIX3: number; LOCALSIZE: number; WORLDMATRIX4: number; WORLDROTATION: number; WORLDSCALE: number }> = ...

Static Priority

Priority: { Align: number; Layout: number; Low: number; Physics: number; Render: number; Tool: number } = ...

Type declaration

  • Align: number
  • Layout: number
  • Low: number
  • Physics: number
  • Render: number
  • Tool: number

Static Readonly RAWLENGTH

RAWLENGTH: 32 = 32

Static Optional Serialize

Serialize: (...args: any[]) => any

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

Accessors

active

  • get active(): boolean
  • set active(value: boolean): void
  • 组件本身是否active

    overload
    memberof

    Component

    Returns boolean

  • 组件本身是否active

    Parameters

    • value: boolean

    Returns void

activeInHierarchy

  • get activeInHierarchy(): boolean
  • 在场景树中是否active

    readonly
    memberof

    Component

    Returns boolean

activeInHierarchyChangedEvent

  • get activeInHierarchyChangedEvent(): Emitter<void, void>
  • active状态变更事件监听器

    memberof

    TransformBase

    Returns Emitter<void, void>

anchor

  • local锚点

    memberof

    Transform2D

    Returns Vector2

  • local锚点

    Parameters

    Returns void

anchorX

  • get anchorX(): number
  • set anchorX(val: number): void
  • 本地锚点x分量

    memberof

    Transform2D

    Returns number

  • 本地锚点x分量

    Parameters

    • val: number

    Returns void

anchorY

  • get anchorY(): number
  • set anchorY(val: number): void
  • 本地锚点y分量

    memberof

    Transform2D

    Returns number

  • 本地锚点y分量

    Parameters

    • val: number

    Returns void

bottomAnchor

  • get bottomAnchor(): number
  • set bottomAnchor(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

bottomOffset

  • get bottomOffset(): number
  • set bottomOffset(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

childChangeEvent

children

  • Returns TransformBase[]

childrenCount

  • get childrenCount(): number
  • 子节点数量

    readonly
    memberof

    TransformBase

    Returns number

isRectTransform

  • get isRectTransform(): boolean
  • set isRectTransform(val: boolean): void
  • Returns boolean

  • Parameters

    • val: boolean

    Returns void

leftAnchor

  • get leftAnchor(): number
  • set leftAnchor(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

leftOffset

  • get leftOffset(): number
  • set leftOffset(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

leftRelative

  • get leftRelative(): number
  • set leftRelative(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

localMatrix3

  • get localMatrix3(): DeepImmutableObject<Matrix3>
  • 本地RTS矩阵,只读

    readonly
    memberof

    Transform2D

    Returns DeepImmutableObject<Matrix3>

parent

  • 父节点

    readonly
    memberof

    TransformBase

    Returns TransformBase

pivot

  • local锚点
    也支持通过pivot获取和设置

    memberof

    Transform2D

    Returns Vector2

  • local锚点
    也支持通过pivot获取和设置

    Parameters

    Returns void

position

  • local位移

    memberof

    Transform2D

    Returns Vector2

  • local位移

    Parameters

    Returns void

positionX

  • get positionX(): number
  • set positionX(val: number): void
  • local位移x分量

    memberof

    Transform2D

    Returns number

  • local位移x分量

    Parameters

    • val: number

    Returns void

positionY

  • get positionY(): number
  • set positionY(val: number): void
  • local位移y分量

    memberof

    Transform2D

    Returns number

  • local位移y分量

    Parameters

    • val: number

    Returns void

rightAnchor

  • get rightAnchor(): number
  • set rightAnchor(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

rightOffset

  • get rightOffset(): number
  • set rightOffset(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

rotation

  • get rotation(): number
  • set rotation(val: number): void
  • local旋转

    memberof

    Transform2D

    Returns number

  • local旋转

    Parameters

    • val: number

    Returns void

scale

  • local缩放

    memberof

    Transform2D

    Returns Vector2

  • local缩放

    Parameters

    Returns void

scaleX

  • get scaleX(): number
  • set scaleX(val: number): void
  • local缩放x分量

    memberof

    Transform2D

    Returns number

  • local缩放x分量

    Parameters

    • val: number

    Returns void

scaleY

  • get scaleY(): number
  • set scaleY(val: number): void
  • local缩放y分量

    memberof

    Transform2D

    Returns number

  • local缩放y分量

    Parameters

    • val: number

    Returns void

size

  • local尺寸

    memberof

    Transform2D

    Returns Vector2

  • local尺寸

    Parameters

    Returns void

sizeX

  • get sizeX(): number
  • set sizeX(val: number): void
  • local尺寸x分量

    memberof

    Transform2D

    Returns number

  • local尺寸x分量

    Parameters

    • val: number

    Returns void

sizeY

  • get sizeY(): number
  • set sizeY(val: number): void
  • local尺寸y分量

    memberof

    Transform2D

    Returns number

  • local尺寸y分量

    Parameters

    • val: number

    Returns void

topAnchor

  • get topAnchor(): number
  • set topAnchor(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

topOffset

  • get topOffset(): number
  • set topOffset(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

topRelative

  • get topRelative(): number
  • set topRelative(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

worldMatrix

  • get worldMatrix(): DeepImmutableObject<Matrix4>
  • 4x4的世界RTS矩阵,为了对齐3D,只读

    readonly
    memberof

    Transform2D

    Returns DeepImmutableObject<Matrix4>

worldMatrix3

  • get worldMatrix3(): DeepImmutableObject<Matrix3>
  • 3x3世界RTS矩阵,只读

    readonly
    memberof

    Transform2D

    Returns DeepImmutableObject<Matrix3>

worldMatrixDirtyEvent

  • get worldMatrixDirtyEvent(): Emitter<void, void>
  • 世界矩阵变更事件监听器

    memberof

    TransformBase

    Returns Emitter<void, void>

worldPosition

  • get worldPosition(): DeepImmutableObject<Vector2>
  • 世界位移,只读

    readonly
    memberof

    Transform2D

    Returns DeepImmutableObject<Vector2>

worldPositionX

  • get worldPositionX(): number
  • 世界位移x分量,只读

    readonly
    memberof

    Transform2D

    Returns number

worldPositionY

  • get worldPositionY(): number
  • 世界位移y分量,只读

    readonly
    memberof

    Transform2D

    Returns number

worldScale

  • get worldScale(): DeepImmutableObject<Vector2>
  • 世界缩放,只读

    readonly
    memberof

    Transform2D

    Returns DeepImmutableObject<Vector2>

Methods

addChild

  • 添加子节点,若子节点已存在父节点,则会先移除其父节点
    子节点必须是Transform2D

    memberof

    Transform2D

    Parameters

    Returns boolean

    是否添加成功

addChildAtIndex

  • addChildAtIndex(child: Transform2D, index: number): boolean
  • 添加子节点到指定index,若子节点已存在父节点,则会先移除其父节点
    子节点必须是Transform2D

    memberof

    Transform2D

    Parameters

    • child: Transform2D

      子节点

    • index: number

      index顺序

    Returns boolean

    添加是否成功

convertWorldPositionToLocal

  • 将世界坐标转换为本地坐标系坐标

    memberof

    Transform2D

    Parameters

    • worldPosition: DeepImmutableObject<Vector2>

      世界坐标

    • Optional dst: Vector2

    Returns Vector2

    本地坐标系坐标

destroy

  • destroy(): void

findChildByName

getSiblingIndex

  • getSiblingIndex(): number
  • 获取同级索引

    memberof

    TransformBase

    Returns number

getTypeName

  • getTypeName(): string

hitTest

  • hitTest(worldPosition: DeepImmutableObject<Vector2>, hitArea?: Rect, dstLocal?: Vector2): boolean
  • 测试该节点世界包围盒是否包含某个点

    memberof

    Transform2D

    Parameters

    • worldPosition: DeepImmutableObject<Vector2>

      测试点的世界坐标

    • Optional hitArea: Rect
    • Optional dstLocal: Vector2

    Returns boolean

    是否包含

immovableAfter

  • 在当前节点后插入新的节点, 新插入的节点世界矩阵不变

    memberof

    Transform2D

    Parameters

    Returns boolean

    是否插入成功

immovableAppendTo

  • 把当前节点添加到指定的parent节点里,作为其子节点。 当前节点世界矩阵不变

    memberof

    Transform2D

    Parameters

    Returns boolean

    是否插入成功

immovableBefore

  • 在当前节点前插入新的节点, 新插入的节点世界矩阵不变

    memberof

    Transform2D

    Parameters

    Returns boolean

    是否插入成功

isDetached

  • isDetached(): boolean

rangeTest

  • rangeTest(startWorldPosition: DeepImmutableObject<Vector2>, endWorldPosition: DeepImmutableObject<Vector2>, hitArea?: Rect): boolean
  • 测试该节点世界包围盒是否在某个区域内

    memberof

    Transform2D

    Parameters

    • startWorldPosition: DeepImmutableObject<Vector2>

      测试点的世界坐标

    • endWorldPosition: DeepImmutableObject<Vector2>

      测试点的世界坐标

    • Optional hitArea: Rect

    Returns boolean

    是否包含

removeChild

  • 删除指定子节点

    memberof

    Transform2D

    Parameters

    Returns boolean

    是否删除成功

resetProperties

  • resetProperties(): void

setSiblingIndex

  • setSiblingIndex(index: number): void
  • 设置同级索引

    memberof

    TransformBase

    Parameters

    • index: number

      同级索引序号

    Returns void

travelChild

Generated using TypeDoc