🎬 toggle

Простая луа, изменяющая альфа-канал цвета rect при нажатии на кнопку.

local gizmos = eh_singleton(eh_runtime_gizmos)
local state = false
local animator = animator_factory.create_linear()

events.add("OnGUI", function()
    if GUILayout.Button("test", GUILayout.Width(100), GUILayout.Height(50)) then
        state = not state
    end
    if Event.current.type == EventType.Repaint then
        animator.reversed = state
        animator.animate(Time.deltaTime)
        gizmos.push_image(-1, Rect(0, 100, 30, 30), Texture2D.whiteTexture, Color(1, 1, 1, animator.value), 0, 1)
    end
end)

Last updated