CanvasUtility | Alternative to CanvasGroups

CanvasUtility

Right now, the only way to change the transparency or color of an entire GuiObject is CanvasGroups, which are fine, but have one major drawback: quality. As of now, CanvasGroups are not suitable for many situations due to the quality of the image being unreliable (eg text blurry, etc). CanvasUtility is a module that can be used till/if Roblox fixes the quality issue of CanvasGroups

Showcase

Setting Transparency
Image from Gyazo

Tweening Transparency
Image from Gyazo

Setting Color
Image from Gyazo

Tweening Color
Image from Gyazo

Usage

CanvasUtility.new(instance: GuiObject): CanvasHandler - instance being the main object you would like to use along with all of its descendants

CanvasHandler:SetTransparency(transparency: number, ignoreObjects: table) - sets the transparency
CanvasHandler:TweenTransparency(transparency: number, tweenInfo: TweenInfo, ignoreObjects: table) - tweens the transparency using the provided tweenInfo

CanvasHandler:SetColor(color: Color3, ignoreObjects: table) - sets the color
CanvasHandler:TweenColor(color: Color3, tweenInfo: TweenInfo, ignoreObjects: table) - tweens the color using the provided tweenInfo
CanvasHandler:ResetColor(ignoreObjects: table) - resets the color using the colors in the OriginalProperties

(UPDATING ORIGINAL PROPS SHOULD ONLY BE DONE IF YOU MANUALLY CHANGE THE COLOR OR TRANSPARENCY OF THE GUIOBJECT)
CanvasHandler:UpdateOriginalProperties(ignoreObjects: table) - updates the original transparencies and colors, only needed if you change the transparency or color of the GuiObject manually
CanvasHandler:UpdateOriginalTransparencies(ignoreObjects: table) - updates the original transparencies only
CanvasHandler:UpdateOriginalColors(ignoreObjects: table) - updates the original colors only

CanvasHandler:Destroy() - destroys the CanvasHandler

Example

local CanvasHandler = CanvasUtility.new(script.Parent.Frame)

CanvasHandler:SetTransparency(.5)
or
CanvasHandler:TweenTransparency(.5, TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out))

Changelog

14/07/22 - Published the module.
19/08/22 - Fixed UpdateOriginal bugs and added an optional ignoreObjects argument, any instances and their descendants will not be effected by the function.

Code

Please report any issues in the replies

The module is available in this model:
:link: CanvasUtility - Roblox

15 Likes