Difference between revisions of "tween"

(Created page with "{{#set:Name=tween}} {{#set:LOVE Version=Any}} {{#set:Description=Small sets of functions for performing tweening in Lua}} Small sets of functions for performing tweening in Lua. ...")
 
(Keyword: Animation)
 
Line 2: Line 2:
 
{{#set:LOVE Version=Any}}
 
{{#set:LOVE Version=Any}}
 
{{#set:Description=Small sets of functions for performing tweening in Lua}}
 
{{#set:Description=Small sets of functions for performing tweening in Lua}}
 +
{{#set:Keyword=Animation}}
 
Small sets of functions for performing tweening in Lua. Based on [http://api.jquery.com/animate/ jQuery’s animate function] by Enrique García Cota aka [https://github.com/kikito kikito].
 
Small sets of functions for performing tweening in Lua. Based on [http://api.jquery.com/animate/ jQuery’s animate function] by Enrique García Cota aka [https://github.com/kikito kikito].
  

Latest revision as of 07:03, 23 December 2016



Small sets of functions for performing tweening in Lua. Based on jQuery’s animate function by Enrique García Cota aka kikito.

Download

local tween = require 'tween'

-- increase the volume of music from 0 to 5 in 10 seconds
local music = { volume = 0, path = "path/to/file.mp3" }
tween(10, music, { volume = 5 })

-- make some text fall from the top of the screen, bouncing on y=300, in 4 seconds
local label = { x=200, y=0, text = "hello" }
tween(4, label, { y=300 }, 'outBounce')

-- fade background to black in 2 seconds, and then print a message on the terminal
local backgroundColor = {255,255,255}
tween(2, backgroundColor, {0,0,0}, 'linear', print, "hello!")


Links