-
Notifications
You must be signed in to change notification settings - Fork 10
/
spinner.lua
42 lines (33 loc) · 1.02 KB
/
spinner.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--[=[
@within Plasma
@function spinner
@tag widgets
A spinner widget, indicating loading.
![A spinner](https://i.eryn.io/2150/RobloxStudioBeta-sEyci8qy.png)
]=]
local RunService = game:GetService("RunService")
local Runtime = require(script.Parent.Parent.Runtime)
return Runtime.widget(function()
local refs = Runtime.useInstance(function(ref)
local Frame = Instance.new("Frame")
Frame.BackgroundTransparency = 1
Frame.Size = UDim2.new(0, 100, 0, 100)
local ImageLabel = Instance.new("ImageLabel")
ImageLabel.AnchorPoint = Vector2.new(0.5, 0.5)
ImageLabel.BackgroundTransparency = 1
ImageLabel.Image = "rbxassetid://2689141406"
ImageLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
ImageLabel.Size = UDim2.new(0, 100, 0, 100)
ImageLabel.Parent = Frame
ref.frame = Frame
return Frame
end)
Runtime.useEffect(function()
local connection = RunService.RenderStepped:Connect(function()
refs.frame.ImageLabel.Rotation = os.clock() * 100 % 360
end)
return function()
connection:Disconnect()
end
end)
end)