2017 © Pedro Peláez
 

package easing

Robert Penner's JavaScript Easing formulas ported to PHP. Similar to jQuery Easing.

image

haberco/easing

Robert Penner's JavaScript Easing formulas ported to PHP. Similar to jQuery Easing.

  • Sunday, May 1, 2016
  • by haberco
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

Easing Formulas

Robert Penner's JavaScript Easing formulas (http://gizma.com/easing/) ported to PHP. Similar to jQuery Easing., (*1)

The "Penner easing functions" have become a standard component of tweening/animation libraries in many languages, from jQuery to Processing. http://www.google.com/#q="penner+easing" https://www.linkedin.com/in/robertpenner, (*2)

I used this to generate an animated series of computer-generated frames generated in ImageMagick assembled with ffmpeg., (*3)

Installation

{
    "require": {
        "haberco/easing": "dev-master"
    }
}

Usage

use \Haberco\Easing\Tween;

$totalFrames = 30;
$startValue = 50;
$changeInValue = 100; // final = 150, startValue + changeInValue

for($frame=0; $frame<$totalFrames; $frame++) {
    $position = Tween::easeInCubic($frame, $startValue, $changeInValue, $totalFrames);
    print "Position is: $position\n";
}

Outputs the following:, (*4)

Position is: 50
Position is: 50.003703703704
Position is: 50.02962962963
Position is: 50.1
Position is: 50.237037037037
Position is: 50.462962962963
Position is: 50.8
Position is: 51.27037037037
Position is: 51.896296296296
Position is: 52.7
Position is: 53.703703703704
Position is: 54.92962962963
Position is: 56.4
Position is: 58.137037037037
Position is: 60.162962962963
Position is: 62.5
Position is: 65.17037037037
Position is: 68.196296296296
Position is: 71.6
Position is: 75.403703703704
Position is: 79.62962962963
Position is: 84.3
Position is: 89.437037037037
Position is: 95.062962962963
Position is: 101.2
Position is: 107.87037037037
Position is: 115.0962962963
Position is: 122.9
Position is: 131.3037037037
Position is: 140.32962962963

Available Methods

Linear is a convenience utility for animation support. * linear, (*5)

Quadratic * easeInQuad * easeOutQuad * easeInOutQuad, (*6)

Cubic * easeInCubic * easeOutCubic * easeInOutCubic, (*7)

Quartic * easeInQuart * easeOutQuart * easeInOutQuart, (*8)

Quintic * easeInQuint * easeOutQuint * easeInOutQuint, (*9)

Sinusoidal * easeInSine * easeOutSine * easeInOutSine, (*10)

Exponential * easeInExpo * easeOutExpo * easeInOutExpo, (*11)

Circular * easeInCirc * easeOutCirc * easeInOutCirc, (*12)

The Versions

01/05 2016

dev-master

9999999-dev

Robert Penner's JavaScript Easing formulas ported to PHP. Similar to jQuery Easing.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Eddie Haber

jquery math animation quart easing tween ease in easein ease out easeout quint sine cubic