Giter Site home page Giter Site logo

aoktian / easing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emmanueloga/easing

0.0 1.0 0.0 219 KB

Easing functions implemented in lua (Functions from http://www.robertpenner.com/easing/ )

Home Page: http://emmanueloga.com

License: Other

Lua 100.00%

easing's Introduction

Easing Library

This is a lua port of the Robert Penner's equations for easing. You can find much more information about it on [http://www.robertpenner.com/easing/](his web site).

This library was based off:

However, only the easing functions are included, and not any kind of tweening helpers.

Usage

Requiring the easing library returns a table which contains all the different functions.

local easingFunctions = require("easing")

outInBounce = easingFunctions.outInBounce

-- All easing functions take these parameters:
--
-- t = time     should go from 0 to duration
-- b = begin    value of the property being ease.
-- c = change   ending value of the property - beginning value of the property
-- d = duration

-- Some functions allow additional modifiers, like the elastic functions
-- which also can receive an amplitud and a period parameters (defaults
-- are included)

beginVal = 0
endVal = 1
change = endVal - beginVal
duration = 1

print(outInBounce(0             , beginVal, change, duration)) --> 0
print(outInBounce(duration / 4  , beginVal, change, duration)) --> 0.3828125
print(outInBounce(duration / 2  , beginVal, change, duration)) --> 0.5
print(outInBounce(duration / 3/4, beginVal, change, duration)) --> 0.10503472222222
print(outInBounce(duration      , beginVal, change, duration)) --> 1

Examples

There is a plain lua example and an interactive one based on the LÖVE game library. To run the examples you'll need to get the engine from http://love2d.org. Once you have the love executable, move into the examples/love directory and run "love ."

love2d running easing examples

Running Tests

To run the tests you'll need telescope. From the library's root directory, run:

▸ tsc tests/easing_tests.lua
80 tests 80 passed 80 assertions 0 failed 0 errors 0 unassertive 0 pending

TODO

Copy the documentation from the tweener source and convert it to luadoc.

License

Like the tweener library, easing is licensed under the MIT license.

Authors

  • Tweener authors
  • Yuichi Tateno
  • Emmanuel Oga

Contributors

easing's People

Contributors

zacharyw avatar seanjensengrey avatar kikito avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.