Last active
August 29, 2020 14:22
-
-
Save Reselim/3d4aa4bac9e6d24879b0deb6c7b8d3de to your computer and use it in GitHub Desktop.
This file contains 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 Roact = require("Roact") | |
local Segments = {} | |
for index = 1, 8 do | |
local X = (index - 1) % 4 | |
local Y = math.floor((index - 1) / 4) | |
table.insert(Segments, { | |
Angle = 360 / (2 ^ index), | |
Location = Vector2.new(X, Y) * 250 | |
}) | |
end | |
return function(props) | |
local segment = table.find(Segments, function(segment) | |
return props.Angle >= segment.Angle | |
end) | |
if not segment then | |
return nil | |
end | |
local image = { | |
Image = "rbxassetid://2692625902", | |
ImageRectSize = Vector2.new(250, 250), | |
ImageRectOffset = segment.Location, | |
Size = UDim2.new(1, 0, 1, 0), | |
BackgroundTransparency = 1 | |
} | |
return Roact.createElement("Frame", { | |
Rotation = props.Start, | |
Size = props.Size, | |
Position = props.Position, | |
AnchorPoint = props.AnchorPoint, | |
BackgroundTransparency = 1 | |
}, { | |
Roact.createElement("ImageLabel", image), | |
Roact.createElement("ImageLabel", table.merge(image, { | |
Rotation = props.Angle - segment.Angle | |
})) | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment