卐 Swaston.lua

Луа, написанная бета тестером (nischenka), создающая радужный, крутящийся *******. Наверное не стоит заносить такое в документацию, но мне она показалась забавной, так что похуй.

Воспринимайте это, как шутку, и не более.

local gizmos = eh_singleton(eh_runtime_gizmos)
local transfusion_speed = 0.6
local size = 12

events.add("OnGUI", function()
    if(not is_in_raid()) then
        return
    end
    if(Event.current.type == EventType.Repaint) then
        local center = Vector2(Screen.width * 0.5, Screen.height * 0.5)

        local function rotate(point, center)
            local rad = math.rad(Time.time * 80)
            local rotated_x = center.x + (point.x - center.x) * math.cos(rad) - (point.y - center.y) * math.sin(rad)
            local rotated_y = center.y + (point.x - center.x) * math.sin(rad) + (point.y - center.y) * math.cos(rad)
            return Vector2(rotated_x, rotated_y)
        end

        local points = {
            Vector2(center.x, center.y - size),
            Vector2(center.x + size, center.y - size),
            Vector2(center.x, center.y + size),
            Vector2(center.x - size, center.y + size),
            Vector2(center.x + size, center.y),
            Vector2(center.x + size, center.y + size),
            Vector2(center.x - size, center.y),
            Vector2(center.x - size, center.y - size)
        }

        for i, point in ipairs(points) do
            points[i] = rotate(point, center)
        end

        local current_color = hsba_color(Mathf.PingPong(Time.time * transfusion_speed, 1), Mathf.PingPong(Time.time * transfusion_speed, 1), 1).to_color()

        gizmos.push_line(-5, center, points[1], current_color, 2)
        gizmos.push_line(-5, points[1], points[2], current_color, 2)
        gizmos.push_line(-5, center, points[3], current_color, 2)
        gizmos.push_line(-5, points[3], points[4], current_color, 2)
        gizmos.push_line(-5, center, points[5], current_color, 2)
        gizmos.push_line(-5, points[5], points[6], current_color, 2)
        gizmos.push_line(-5, center, points[7], current_color, 2)
        gizmos.push_line(-5, points[7], points[8], current_color, 2)
    end 
end)

Last updated