Skip to content
y-lohse edited this page Dec 27, 2012 · 4 revisions

An implementation of a mathematical Matrix. It is mainly used as a mean to apply transformations to a canvas rendering context.

List of properties

List of functions

Properties

a:Integer

Default is 1

b:Integer

Default is 0

c:Integer

Default is 0

d:Integer

Default is 1

tx:Integer

Default is 0

ty:Integer

Default is 0

Functions

__construct:Cannon.Math.Matrix

Parameters

  • a:Float
  • b:Float
  • c:Float
  • d:Float
  • tx:Float
  • ty:Float

Description

Creates a new matrix. All parameters are optional.

apply:Void

Parameters

  • ctx:CanvasRenderingContext

Description

Applies the matrix to a given context, combining it with the current modifications

override:Void

Parameters

  • ctx:CanvasRenderingContext

Description

Applies the current matrix to the context, ovveriding all current context settings

clone:Cannon.Math.Matrix

Description

Returns a clone of the current matrix

multiply:Void

Parameters

  • m2:Cannon.Math.Matrix

Description

Multiplies the current matrix by another one, effectively combining theire effect

identity:Void

Description

Resets the matrix so that it will have no effect

invert:Void

Description

Inverts the current effect of the matrix

rotate:Void

Parameters

  • angle:Float : rotation angle in radians

Description

Rotates the matrix

scale:Void

Parameters

  • sx:Float : x scale
  • sy:Float : y scale

Description

Scales the matrix

translate:Void

Parameters

  • tx:Float : x translation
  • ty:Float : y translation

Description

Applies a translation to the matrix