Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Size

二维尺寸。

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • newSize(other: Size): Size
  • newSize(width?: undefined | number, height?: undefined | number): Size
  • en

    Constructor a size from another one.

    zh

    构造与指定尺寸相等的尺寸。

    Parameters

    • other: Size

      Specified Size.

    Returns Size

  • en

    Constructor a size with specified values.

    zh

    构造具有指定宽度和高度的尺寸。

    Parameters

    • Optional width: undefined | number

      width of the Size, default value is 0.

    • Optional height: undefined | number

      height of the Size, default value is 0.

    Returns Size

Properties

height

height: number

width

width: number

Static ONE

ONE: {} = Object.freeze(new Size(1, 1))

Type declaration

Static ZERO

ZERO: {} = Object.freeze(new Size(0, 0))

Type declaration

Accessors

x

  • get x(): number
  • set x(val: number): void

y

  • get y(): number
  • set y(val: number): void

Methods

clone

equals

  • equals(other: Size): boolean
  • 判断当前尺寸是否与指定尺寸的相等。

    Parameters

    • other: Size

      Specified Size

    Returns boolean

    Returns true' when both dimensions are equal in width and height; otherwise returnsfalse'.

lerp

  • lerp(to: Size, ratio: number): this
  • 根据指定的插值比率,从当前尺寸到目标尺寸之间做插值。

    Parameters

    • to: Size

      Target Size.

    • ratio: number

      The interpolation coefficient.The range is [0,1].

    Returns this

set

  • set(other: Size): any
  • set(width?: undefined | number, height?: undefined | number): any

toString

  • toString(): string

Static lerp

  • lerp<Out>(out: Out, from: Out, to: Out, ratio: number): Out
  • 根据指定的插值比率,从当前尺寸到目标尺寸之间做插值。

    Type parameters

    Parameters

    • out: Out

      Output Size.

    • from: Out

      Original Size.

    • to: Out

      Target Size.

    • ratio: number

      The interpolation coefficient.The range is [0,1].

    Returns Out

    A vector consisting of linear interpolation of the width and height of the current size to the width and height of the target size at a specified interpolation ratio, respectively.

Generated using TypeDoc