example added
This commit is contained in:
@@ -4,7 +4,7 @@ A Löve Gui based on Flexbox
|
||||
|
||||
FlexLöve is a lightweight, flexible GUI library for Löve2D that implements a flexbox-based layout system. It provides a simple way to create and manage UI elements like windows and buttons with automatic layout calculations, animations, and responsive design.
|
||||
|
||||
# This library is no where near ready for sane use, there are many broken, incomplete and missing features.
|
||||
# NOTE: This library is no where near ready for sane use, there are many broken, incomplete and missing features.
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
67
examples/OnClickAnimations.lua
Normal file
67
examples/OnClickAnimations.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local FlexLove = require("FlexLove")
|
||||
local Gui = FlexLove.GUI
|
||||
local Color = FlexLove.Color
|
||||
|
||||
---@class AnimDemo
|
||||
---@field window Window
|
||||
---@field button Button
|
||||
---@field fadeButton Button
|
||||
---@field scaleButton Button
|
||||
local OnClickAnimDemo = {}
|
||||
OnClickAnimDemo.__index = OnClickAnimDemo
|
||||
|
||||
function OnClickAnimDemo.init()
|
||||
local self = setmetatable({}, OnClickAnimDemo)
|
||||
|
||||
-- Create a demo window
|
||||
self.window = Gui.Window.new({
|
||||
x = 100,
|
||||
y = 100,
|
||||
z = 10,
|
||||
w = 300,
|
||||
h = 200,
|
||||
background = Color.new(0.1, 0.1, 0.3, 0.8),
|
||||
border = { top = true, bottom = true, left = true, right = true },
|
||||
borderColor = Color.new(0.7, 0.7, 0.7, 1),
|
||||
})
|
||||
|
||||
-- Create a fade button
|
||||
self.fadeButton = Gui.Button.new({
|
||||
parent = self.window,
|
||||
x = 20,
|
||||
y = 80,
|
||||
w = 100,
|
||||
h = 40,
|
||||
text = "Fade",
|
||||
background = Color.new(0.2, 0.9, 0.6, 0.8),
|
||||
textColor = Color.new(1, 1, 1),
|
||||
borderColor = Color.new(0.4, 1, 0.8, 1),
|
||||
callback = function()
|
||||
-- Create a fade animation
|
||||
local fadeAnim = Gui.Animation.fade(1, 0.8, 0.2)
|
||||
fadeAnim:apply(self.window)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Create a scale button
|
||||
self.scaleButton = Gui.Button.new({
|
||||
parent = self.window,
|
||||
x = 20,
|
||||
y = 140,
|
||||
w = 100,
|
||||
h = 40,
|
||||
text = "Scale",
|
||||
background = Color.new(0.9, 0.6, 0.2, 0.8),
|
||||
textColor = Color.new(1, 1, 1),
|
||||
borderColor = Color.new(1, 0.8, 0.4, 1),
|
||||
callback = function()
|
||||
-- Create a scale animation
|
||||
local scaleAnim = Gui.Animation.scale(1.5, { width = 100, height = 40 }, { width = 200, height = 80 })
|
||||
scaleAnim:apply(self.button)
|
||||
end,
|
||||
})
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
return OnClickAnimDemo.init()
|
||||
Reference in New Issue
Block a user