Created
June 23, 2024 14:53
-
-
Save Be1zebub/ba85104fdba1f1af01b3c2cf1efeba8e to your computer and use it in GitHub Desktop.
не ищите в этом смысла, я просто веселился
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local traceRainbowSpeed = 360 / 2 | |
local traceLength = 360 / 4 | |
local trace = {} | |
local prevX, prevY = input.GetCursorPos() | |
local function DrawTrace() | |
local x, y = input.GetCursorPos() | |
do | |
local dx = x - prevX | |
local dy = y - prevY | |
local dist = math.sqrt(dx * dx + dy * dy) | |
local step = 4 | |
for i = 0, dist, step do | |
if #trace == traceLength then | |
table.remove(trace, 1) | |
end | |
table.insert(trace, { | |
x = prevX + dx * (i / dist), | |
y = prevY + dy * (i / dist) | |
}) | |
end | |
end | |
prevX, prevY = x, y | |
for i, tr in ipairs(trace) do | |
local c = (#trace - i + 1) / #trace | |
local col = HSVToColor((SysTime() * traceRainbowSpeed + c * 360) % 360, 1, 1) | |
local size = 8 + c * 16 | |
surface.SetDrawColor(col.r, col.g, col.b, 255 - c * 255) | |
surface.DrawRect(tr.x - size, tr.y - size, size, size) | |
end | |
end | |
local radius = 64 | |
local speed = 8 | |
local function MoveCursor() | |
local ang = SysTime() * speed | |
local x = ScrW() * 0.5 + math.cos(ang) * radius | |
local y = ScrH() * 0.5 + math.sin(ang) * radius | |
input.SetCursorPos(x, y) | |
end | |
hook.Add("HUDPaint", "joy cursor", function() | |
MoveCursor() | |
if vgui.CursorVisible() then | |
DrawTrace() | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment