The motionPath function

Creates a motion path Force when passed a Plain Shape Object.


motionPath(plainShapeObject)
    

Arguments

plainShapeObject

The Plain Shape Object creates a motion path relative to the Shape it is applied to. For this reason it should almost always start from the point { x: 0, y: 0 }.

This Plain Shape Object can take three properties that have special significance in relation to a motion path.

  • accuracy (optional) is a number, in degrees, that Wilderness determines a curve "straight enough" to be considered a straight line. This will determine how accurately a Shape follows a motion path. However, the more accurate, the more calculations required, and therefore the worse the performance.
  • easing (optional) is a string that maps to a function defined in Tween Functions, or a custom easing function. This is the easing with which the Shape travels the motion path.
  • rotate (optional) is a boolean or a number that determines if the Shape should rotate along with the motion path. If set to a number, this is the angle to which the Shape is offset against the motion path's current angle.

Return value

A Force function.