• Stars
    star
    155
  • Rank 237,008 (Top 5 %)
  • Language
    Lua
  • License
    Other
  • Created over 13 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

  • kikito (Enrique García) (#2)

More Repositories

1

simple-angular-rails-app

Simple Angular App with a Rails backend
Ruby
113
star
2

firering

Eventmachine powered Campfire API
Ruby
20
star
3

NeonTetra

A simple proof of concept of storing content on TerminusDB for a CMS-like system.
JavaScript
14
star
4

columns

A 2d columns game using LÖVE (http://love2d.org/)
Lua
12
star
5

cp3

A backup copy of the materials for CP3 at https://sites.google.com/site/stevenhalim/home/material (my reorg)
Java
12
star
6

tweener

A lua library for inbetweening
Lua
9
star
7

lua-parsing-examples

Some very simple LL(K) parsers implemented with lua
Lua
6
star
8

irc_parser

Parses and generates irc messages
Ruby
4
star
9

risbn

ruby utils for handling isbn numbers.
Ruby
4
star
10

simple-ec2-infra

simple-infra
JavaScript
4
star
11

load_data_infile

MySQL LOAD DATA INFILE support for ActiveRecord
Ruby
3
star
12

mwalker

walks your path tree looking for files matching a given subsequence
Lua
2
star
13

manticoresearch-manual

Manticore Search Manual, Reformatted
Python
2
star
14

vimrc

My vim configuration
Vim Script
1
star
15

dom-perignon

examples of knockout and angular
JavaScript
1
star
16

sets_uuid

Adds declarative uuid attribute initialization to models
Ruby
1
star
17

ttl

A simple Hash like collection with ttl
Ruby
1
star
18

lfsr

The generation of random numbers is too important to be left to chance.
C
1
star
19

valatup

sample tup managed vala project
Vala
1
star
20

ircd_slim

An small IRC server
Ruby
1
star
21

hypergraphdb

Automatically exported from code.google.com/p/hypergraphdb
Java
1
star
22

emmanueloga.github.io

Blog.
CSS
1
star
23

plangs2

A database of programming languages.
TypeScript
1
star