love-nuklear/example/transform.lua
2018-12-13 16:03:52 -05:00

16 lines
620 B
Lua

-- Apply transformations to a basic UI.
return function(ui)
local t = love.timer.getTime()
ui:translate(350 + 100 * math.cos(t / 4), 350 + 100 * math.sin(t / 4))
ui:rotate(t / 8)
ui:scale(1 + math.sin(t / 4) / 2, 1 + math.cos(t / 4) / 2)
ui:shear(math.cos(t / 8) / 4, math.sin(t / 8) / 4)
if ui:windowBegin('Transform', 0, 0, 200, 200, 'border', 'movable', 'title') then
ui:layoutRow('dynamic', 100, 1)
ui:label('You can apply transformations to the UI using ui:rotate, ui:scale, ui:shear, and ui:translate.', 'wrap')
ui:layoutRow('dynamic', 30, 1)
ui:button('Try and catch me!')
end
ui:windowEnd()
end