How to convert UI corner offset to scale

I think the title says it all, however how do I convert the offset of a ui corner to scale

1 Like

Uhh… I don’t think UICorner matters for scale or offset, the only property it has for ‘size’ is CornerRadius and it’s only calculated in pixels. Just setting the Parent of UICorner to scale, should make UICorner scale respectively with the parent, maybe even with offset. (Not sure if this is what you’re looking for)

1 Like

If you mean converting the Corner offset scale in pixels to a Scale percent?
If thats what your looking for just divide the AbsoluteSize value into the Corner size offset value to get a 0.0 - 1.0 percentage which then can be set via script.

Something like this:

CornerUI.CornerRadius = Udim.new(CornerUI.CornerRadius.Offset/FrameUI.AbsoluteSize.X,0)

3 Likes

You should try this method:

local UICorner = nil -- UICorner object here

local CornerRadius = UICorner.CornerRadius
local rectWidth = UICorner.Parent.AbsoluteSize.X
local rectHeight = UICorner.Parent.AbsoluteSize.Y

local Radius = math.min(math.min(rectWidth, rectHeight) / 2, CornerRadius.Scale * math.min(rectWidth, rectHeight) + CornerRadius.Offset)
Radius = Radius/rectHeight

UICorner.CornerRadius = UDim.new(Radius,0)
7 Likes