Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Size

Two dimensional size type representing the width and height.

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
  • Check whether the current Size equals another one.

    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
  • Calculate the interpolation result between this size and another one with given ratio

    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
  • Calculate the interpolation result between this size and another one with given ratio

    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