Animation System
Smooth animations with easing functions.
Basic Animation
cLib.Animate({
from = 0,
to = 255,
duration = 0.5,
ease = cLib.Ease.OutQuad,
onUpdate = function(value)
panel:SetAlpha(value)
end,
onComplete = function()
print("Done!")
end
})Options
| Option | Type | Description |
|---|---|---|
from | number | Start value |
to | number | End value |
duration | number | Duration in seconds |
ease | function | Easing function |
delay | number | Delay before start |
onUpdate | function | Called each frame |
onComplete | function | Called when done |
Animate Multiple Values
cLib.AnimateMultiple({
from = {x = 0, y = 0, scale = 0.5},
to = {x = 100, y = 50, scale = 1},
duration = 0.3,
ease = cLib.Ease.OutBack,
onUpdate = function(values)
panel:SetPos(values.x, values.y)
panel:SetScale(values.scale)
end
})Animate Colors
cLib.AnimateColor({
from = Color(255, 0, 0),
to = Color(0, 255, 0),
duration = 1,
onUpdate = function(color)
panel.bgColor = color
end
})Control Animations
-- Start animation (returns ID)
local animId = cLib.Animate({...})
-- Stop animation
cLib.StopAnimation(animId)
-- Check if running
if cLib.IsAnimating(animId) then
print("Still animating...")
end
-- Get current value
local value = cLib.GetAnimationValue(animId)