From 6d7f6e7c9d2327acd7c5945cfad091c5cc13e011 Mon Sep 17 00:00:00 2001
From: Matthias Richter
Note the . (dot) in the function names. It is an error to call Timer.add
with a colon! If you
get weird errors, that might be the cause.
delay
:func
:count
:count
:func
with the right parameters. It returns true
as long as
the interpolation is not yet finished or nil
if the interpolation stopped as well
as any parameters that the function returns.
+ The prototype of the functions are:
function arg(fraction, ...)
where ...
are additional arguments.function inter(dt, ...)
where ...
are arguments that get passed to argParameters: | [number]length : | Interpolation length. |
---|---|---|
[function]func : | Interpolating function. | |
Returns | A function inter(dt) with argument dt that has
+ | |
Returns | A function inter(dt, ...) that has
+ to be called in love.update . |
The function does the same as Interpolator
, except that if the passed time reaches length
,
+ the internal timer will be reset. That means that the fraction
-argument of the oscillating
+ function will loop from 0 to 1.
See the example for clarification
+Parameters: | [number]length : | Length of one period. |
---|---|---|
[function]func : | Oscillating function. | |
Returns | A function osc(dt, ...) that has
to be called in love.update . |
function love.load() love.graphics.setBackgroundColor(0,0,0) love.graphics.setColor(0,0,0) @@ -340,7 +361,7 @@ end xpos = 100 fader = Interpolator(5, function(frac) love.graphics.setBackgroundColor(frac*255,frac*255,frac*255) end) -mover = Interpolator(10, function(frac) xpos = 10 + 600 * frac end) +mover = Oscillator(10, function(frac) xpos = 400 + 300 * math.sin(2*math.pi*frac) end) function love.update(dt) fader(dt) mover(dt) @@ -657,7 +678,7 @@ result:foo() -- error: method does not existview source Depends on vector.lua
Camera object to display only a partial region of the game world. The region - can be zoomed and rotated. You can transform camera coordinates to world coordinated + can be moved, zoomed and rotated. You can transform camera coordinates to world coordinated (e.g. get the location of the mouse in the game world). It is possible to have more than one camera per game.