Cubic Bezier v0.0.2 CubicBezier

Elixir port of the the JavaScript port of Webkit implementation of CSS cubic-bezier(p1x.p1y,p2x,p2y) by http://mck.me

http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h https://gist.github.com/mckamey/3783009

Link to this section Summary

Functions

Defines a cubic-bezier curve given the middle two control points. NOTE: first and last control points are implicitly (0,0) and (1,1).

Return a control points tuple based on the easing equation name.

@param t {number} parametric timing value @return {number}

@param t {number} parametric timing value @return {number}

@param t {number} parametric timing value @return {number}

Given x (a float between 0.0 and 1.0), compute the y; which essentially acts a "speed". Optioanally, a duration can be provided which can provide greater accuracy. The default is 400 (ms), which is a common animation / transition duration.

Given an x value, find a parametric value it came from.

The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds.

@param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0 @param epsilon {number} the accuracy of t for the given x @return {number} the y value along the bezier curve

Link to this section Functions

Link to this function

calculate_coefficients(arg)

Defines a cubic-bezier curve given the middle two control points. NOTE: first and last control points are implicitly (0,0) and (1,1).

@param p1x {number} X component of control point 1 @param p1y {number} Y component of control point 1 @param p2x {number} X component of control point 2 @param p2y {number} Y component of control point 2

Link to this function

control_points(atom)

Return a control points tuple based on the easing equation name.

See: https://gist.github.com/terkel/4377409

Link to this function

sample_curve_derivative_x(t, arg)

@param t {number} parametric timing value @return {number}

Link to this function

sample_curve_x(t, arg)

@param t {number} parametric timing value @return {number}

Link to this function

sample_curve_y(t, arg)

@param t {number} parametric timing value @return {number}

Link to this function

solve(x, easing, duration \\ 400)

Given x (a float between 0.0 and 1.0), compute the y; which essentially acts a "speed". Optioanally, a duration can be provided which can provide greater accuracy. The default is 400 (ms), which is a common animation / transition duration.

Link to this function

solve_curve_x(x, epsilon, coefficients)

Given an x value, find a parametric value it came from.

@param x {number} value of x along the bezier curve, 0.0 <= x <= 1.0 @param epsilon {number} accuracy limit of t for the given x @return {number} the t value corresponding to x

Link to this function

solve_epsilon(duration)

The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds.

The longer the animation, the more precision we need in the timing function result to avoid ugly discontinuities.

http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/page/animation/AnimationBase.cpp

Link to this function

solve_with_epsilon(x, epsilon, coefficients)

@param x {number} the value of x along the bezier curve, 0.0 <= x <= 1.0 @param epsilon {number} the accuracy of t for the given x @return {number} the y value along the bezier curve

Renamed from solve