Class allows you to specify custom easing function by SVG path line commands. Line commands should by in range of rect 100x100.
Parameters:
{String, DOMNode}
options
must be an Object.Method _vars
Method to create variables
options
util variables
Constructor
the class can work as a "creator" of self instances so no need to init if 'creator' passed insted of path
console.time 'pre sample'
console.timeEnd 'pre sample'
Method _preSample sideEffect {Array} _samples - set of sampled points
Samples the path on init
Method _findBounds
Parameters:
to
must be an Array.progress
must be a Number.Returns an Object
(- start {Number}: lowest boundry - end {Number}: highest boundry)
get the start index in the array reset the cached prev progress if new progress is smaller then previous one or it is not defined
save the latest smaller value as start value
cache the bounds start index for further usage
save the first larger value as end value and break immediately
Method sample
Loop thru path trying to find the most closer x compared to current progress value
Parameters:
easing
must be a Number.Returns a Number
(easing y)
Method _checkIfBoundsCloseEnough
Check if one of bounds.start or bounds.end is close enough to searched progress
Parameters:
progress
must be a Number.bounds
must be an Object.Returns a Number, Undefined
(returns Y value if true, undefined if false)
check if start bound is close enough
check if end bound is close enough
Method _checkIfPointCloseEnough
Check if bound point close enough to progress
Parameters:
progress
must be a Number.bound
must be an Object.Returns a Number, Undefined
(returns Y value if true, undefined if false)
Method _approximate
Parameters:
start
must be an Object.end
must be an Object.progress
must be a Number.Returns an Object
(approximation)
Method _findApproximate
Parameters:
progress
must be a Number.start
must be an Object.end
must be an Object.Returns a Nunomber
(y approximation)
if close enough resolve the y value
if looping for a long time
not precise enough so we will call self again recursively, lets find arguments for the call
Method resolveY
Parameters:
SVG
must be an Object.Returns a Number
(normalized y)
Method create
Create new instance of PathEasing with specified parameters Please see the docs for PathEasing for more details on params.
Parameters:
path
must be a String, DOMNode.Returns an Object
(easing y)
todo