API Docs for: 3.5.1
Show:

Plugin.Flick Class

A plugin class which can be used to animate the motion of a node, in response to a flick gesture.

Methods

_anim

(
  • x
  • y
  • duration
  • easing
)
private

Internal utility method to perform the transition step

Parameters:

  • x Number

    The X offset position

  • y Number

    The Y offset position

  • duration Number

    The duration to use for the transition animation

  • easing String

    The easing to use for the transition animation.

_bounce

(
  • x
  • max
)
private

Internal utility method to constrain the offset value based on the bounce criteria.

Parameters:

  • x Number

    The offset value to constrain.

  • max Number

    The max offset value.

_flickFrame

() protected

Executes a single frame in the flick animation

_killTimer

() private

Stop the animation timer

_move

(
  • x
  • y
  • duration
  • easing
)
private

Internal utility method to move the node to a given XY position, using transitions, if specified.

Parameters:

  • x Number

    The X offset position

  • y Number

    The Y offset position

  • duration Number

    The duration to use for the transition animation

  • easing String

    The easing to use for the transition animation.

_onFlick

(
  • e
)
protected

The flick event listener. Kicks off the flick animation.

Parameters:

  • e EventFacade

    The flick event facade, containing e.flick.distance, e.flick.velocity etc.

_renderClasses

() protected

Adds the CSS classes, necessary to set up overflow/position properties on the node and boundingBox.

_round

() private

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:10

Rounds values

_setX

(
  • val
)
private

Internal utility method to set the X offset position

Parameters:

_setY

(
  • val
)
private

Internal utility method to set the Y offset position

Parameters:

angle2rad

(
  • val
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:44

Converts an angle to a radian

Parameters:

  • val Objecxt

    Value to be converted to radian.

Returns:

Number

compareTransformSequence

(
  • list1
  • list2
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:415

Compares to arrays or transform functions to ensure both contain the same functions in the same order.

Parameters:

  • list1 Array

    Array to compare

  • list2 Array

    Array to compare

Returns:

Boolean

decompose

(
  • 3x3
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:296

Breaks up a 2d transform matrix into a series of transform operations.

Parameters:

Returns:

Array

deg2rad

(
  • deg
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:32

Converts a degree value to a radian.

Parameters:

  • deg Number

    Degree value to be converted to radian.

Returns:

Number

getDeterminant

(
  • matrix
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:83

Returns the determinant of a given matrix.

/ \ | matrix[0][0] matrix[1][0] matrix[2][0] | | matrix[0][1] matrix[1][1] matrix[2][1] | | matrix[0][2] matrix[1][2] matrix[2][2] | | matrix[0][3] matrix[1][3] matrix[2][3] | \ /

Parameters:

  • matrix Array

    An nxn matrix represented an array of vector (column) arrays. Each vector array has index for each row.

Returns:

Number

getMinors

(
  • matrix
  • columnIndex
  • rowIndex
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:223

Returns a matrix of minors based on a matrix, column index and row index.

Parameters:

  • matrix Array

    The matrix from which to extract the matrix of minors.

  • columnIndex Number

    A zero-based index representing the specified column to exclude.

  • rowIndex Number

    A zero-based index represeenting the specified row to exclude.

Returns:

Array

getnxn

()

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:61

Converts a transform object to an array of column vectors.

/ \ | matrix[0][0] matrix[1][0] matrix[2][0] | | matrix[0][1] matrix[1][1] matrix[2][1] | | matrix[0][2] matrix[1][2] matrix[2][2] | \ /

Returns:

Array

getTransformArray

(
  • val
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:344

Parses a transform string and returns an array of transform arrays.

Parameters:

  • val String

    A transform string

Returns:

Array

getTransformFunctionArray

()

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:383

Returns an array of transform arrays representing transform functions and arguments.

Returns:

Array

initializer

(
  • config
)

The initializer lifecycle implementation.

Parameters:

  • config Object

    The user configuration for the plugin

inverse

(
  • Array
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:123

Returns the inverse of a matrix

Parameters:

  • Array Object

    matrix An array representing an nxn matrix

Returns:

Array / \ | matrix[0][0] matrix[1][0] matrix[2][0] | | matrix[0][1] matrix[1][1] matrix[2][1] | | matrix[0][2] matrix[1][2] matrix[2][2] | | matrix[0][3] matrix[1][3] matrix[2][3] | \ /

rad2deg

(
  • rad
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:20

Converts a radian value to a degree.

Parameters:

  • rad Number

    Radian value to be converted.

Returns:

Number

scalarMultiply

(
  • matrix
  • multiplier
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:176

Multiplies a matrix by a numeric value.

Parameters:

  • matrix Array

    The matrix to be altered.

  • multiplier Number

    The number to multiply against the matrix.

Returns:

Array

setBounds

()

Sets the min/max boundaries for the flick animation, based on the boundingBox dimensions.

sign

(
  • val
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:257

Returns the sign of value

Parameters:

  • val Number

    value to be interpreted

Returns:

Number

transpose

(
  • matrix
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:199

Returns the transpose for an nxn matrix.

Parameters:

  • matrix Object

    An nxn matrix represented by an array of vector arrays.

Returns:

Array

vectorMatrixProduct

(
  • vector
  • matrix
)

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:269

Multiplies a vector and a matrix

Parameters:

  • vector Array

    Array representing a column vector

  • matrix Array

    Array representing an nxn matrix

Returns:

Array

Properties

_rounder

Unknown private

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:2

Used as value for the _rounding method.

CLASS_NAMES

Object static

The default CSS class names used by the plugin

EASING

String static

The default easing to use for the main flick movement transition

Default: 'cubic-bezier(0, 0.1, 0, 1.0)'

NAME

String static

The NAME of the Flick class. Used to prefix events generated by the plugin.

Default: "pluginFlick"

NS

String static

The namespace for the plugin. This will be the property on the node, which will reference the plugin instance, when it's plugged in.

Default: "flick"

SNAP_DURATION

Number static

The duration to use for the bounce snap-back transition

Default: 400

SNAP_EASING

String static

The default easing to use for the bounce snap-back transition

Default: 'ease-out'

transformMethods

Object

Provided by the matrix module.

Defined in matrix/js/MatrixUtil.js:444

Mapping of possible transform method names.

VELOCITY_THRESHOLD

Number static

The threshold used to determine when the decelerated velocity of the node is practically 0.

Default: 0.015

Attributes

bounce

Number

Drag coefficient for intertial scrolling at the upper and lower boundaries of the scrollview. Set to 0 to disable "rubber-banding".

Default: 0.7

Fires event bounceChange

Fires when the value for the configuration attribute bounce is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

bounceDistance

Number

The bounce distance in pixels

Default: 150

Fires event bounceDistanceChange

Fires when the value for the configuration attribute bounceDistance is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

boundingBox

Node

The constraining box relative to which the flick animation and bounds should be calculated.

Default: parentNode

Fires event boundingBoxChange

Fires when the value for the configuration attribute boundingBox is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

boundingBox

Node

The constraining box relative to which the flick animation and bounds should be calculated.

Default: parentNode

Fires event boundingBoxChange

Fires when the value for the configuration attribute boundingBox is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

deceleration

Drag coefficent for inertial scrolling. The closer to 1 this value is, the less friction during scrolling.

Default: 0.98

Fires event decelerationChange

Fires when the value for the configuration attribute deceleration is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

duration

Number

The custom duration to apply to the flick animation. By default, the animation duration is controlled by the deceleration factor.

Default: null

Fires event durationChange

Fires when the value for the configuration attribute duration is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

easing

String

The custom transition easing to use for the flick animation. If not provided defaults to internally to Flick.EASING, or Flick.SNAP_EASING based on whether or not we're animating the flick or bounce step.

Default: null

Fires event easingChange

Fires when the value for the configuration attribute easing is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

minVelocity

Number

The minimum flick gesture velocity (px/ms) at which to trigger the flick response

Default: 0

Fires event minVelocityChange

Fires when the value for the configuration attribute minVelocity is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

minVelocity

Number

The minimum flick gesture distance (px) for which to trigger the flick response

Default: 10

Fires event minVelocityChange

Fires when the value for the configuration attribute minVelocity is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.