From 9664c7583063aa7cb181c617cc14c8743edd1923 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Tue, 18 Mar 2025 02:50:15 +0100 Subject: [PATCH] Added resize to animation --- src/plugins/animation.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/animation.lua b/src/plugins/animation.lua index af12e16..040d3cb 100644 --- a/src/plugins/animation.lua +++ b/src/plugins/animation.lua @@ -288,6 +288,26 @@ Animation.registerAnimation("move", { end }) +Animation.registerAnimation("resize", { + start = function(anim) + anim.startW = anim.element.get("width") + anim.startH = anim.element.get("height") + end, + + update = function(anim, progress) + local w = anim.startW + (anim.args[1] - anim.startW) * progress + local h = anim.startH + (anim.args[2] - anim.startH) * progress + anim.element.set("width", math.floor(w)) + anim.element.set("height", math.floor(h)) + return progress >= 1 + end, + + complete = function(anim) + anim.element.set("width", anim.args[1]) + anim.element.set("height", anim.args[2]) + end +}) + Animation.registerAnimation("moveOffset", { start = function(anim) anim.startX = anim.element.get("offsetX")