Module: lib-tde.animations

Animate any lua object over a period of time

This api is generally designed for wiboxes, but it can be used for any lua table

In this example we will animate the wibox over 2 seconds, changing its width and height

local example = wibox {
    ontop = true,
    screen = screen,
    width = 100,
    height = 100,
    x = 0,
    y = 0,
}
-- usually you start animation when clicking on a button
-- In this example we use out cubic (see the tweening diagram below)
animate(2, example, { width=200, height=200 }, "outCubic")

Useful when you want to override user settings.

Such as in the settings app.

The possible tween values plotted:

Tween values plotted

Info:

  • Copyright: 2020 Tom Meyers
  • Author: Tom Meyers

Static module functions

lib-tde.animations.createAnimObject (duration, subject, target, easing[, end_callback[, delay[, widget[, tween_callback]]]]) Create an animation out of a lua table


Static module functions

lib-tde.animations.createAnimObject (duration, subject, target, easing[, end_callback[, delay[, widget[, tween_callback]]]])
Create an animation out of a lua table

Parameters:

  • duration number How long should the animation take
  • subject wibox The subject to animate
  • target table A table of properties of the subject to tween (these will be animated)
  • easing string The easing function to use
  • end_callback function This function will be called when the animation finished (optional)
  • delay number How long to wait until we start the animation (optional)
  • widget wibox Alternative widget we use to hook animation properties on (optional)
  • tween_callback function A callback that happens on every animation trigger (every frame) (optional)

Usage:

    -- This will create and start the animation that tweens the y property to 100 over 3 seconds using the outCubic calculation
    lib-tde.animations.createAnimObject(3, object, {y = 100}, "outCubic", function()
       print("Done animating")
     end)
generated by LDoc 1.4.6 Build with 💜 By F0xedb Last updated 2021-05-21 03:30:15