API Docs for: v2.1.0
Show:

CGSGMask Class

Extends CGSGObject
Module: Animation

Utility class which represents a mask to apply on several nodes. The class should be sub-classed to define particular rendering. This class actually does not any rendering. However, when its 'apply' method is called, it begins to observe the given node and calls rendering methods which should be overridden.

Two key methods are provided here :

  • prepare which is called before the node and its children is rendered
  • finalize which is called once the rendering of the node has been done

Constructor

CGSGMask

()

Methods

_eventAdapter

(
  • event
)
private

Observer method which catches key events to apply the mask.

Parameters:

_internalApply

(
  • node
)
private

Override this method to perform custom additional stuff when applying this mask.

Parameters:

_internalRemove

(
  • node
)
private

Override this method to perform custom additional stuff when removing this mask.

Parameters:

apply

(
  • node
)

Apply this mask to the given node.

Parameters:

finalize

(
  • node
  • context
)

Method to override to finish the mask rendering.

Parameters:

  • node CGSGNode

    the observed node

  • context CanvasRenderingContext2D

    the context

prepare

(
  • node
  • context
)

Method to override to prepare the given context to render.

Parameters:

  • node CGSGNode

    the observed node

  • context CanvasRenderingContext2D

    the context

remove

(
  • node
)

Removes this mask from a node.

Parameters:

  • node Object

    CGSGNode the node