{"id":"stratiz/Transparency","name":"Transparency","scope":"stratiz","platform":"roblox","description":"Object for setting the transparency of an entire instance and its descendants.","version":"1.4.0","latest":"1.4.0","versions":["1.0.0","1.0.1","1.1.0","1.2.0","1.3.0","1.4.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"be790cc5896d0faf835c1b69e79fd6ec3e22c3c6e44ccb54fa27f7e4e436cd63","likes":1,"downloads":2222,"install":"forest install stratiz/Transparency","url":"https://forest.dev/p/roblox/stratiz/Transparency","files":"https://api.forest.dev/ai/package/roblox/stratiz/Transparency/files","readme":"# Transparency\r\n\r\nSets the transparency of an instance and all of its descendants together, while remembering each object's original transparency.\r\n\r\nOn creation it caches the transparency properties of the target and its descendants. `Set` then scales every cached value between its original and fully transparent.\r\n\r\n## Usage\r\n\r\n```lua\r\nlocal Transparency = require(path.to.Transparency)\r\n\r\nlocal transparency = Transparency.new(workspace.Model)\r\n\r\ntransparency:Set(0.5) -- half faded from the original values\r\ntransparency:Set(1)   -- fully transparent\r\ntransparency:Set(0)   -- back to the original values\r\n\r\ntransparency:Destroy()\r\n```\r\n\r\n## Supported classes\r\n\r\nFrame, ScrollingFrame, CanvasGroup, ImageLabel, ImageButton, TextLabel, TextButton, TextBox, ViewportFrame, UIStroke, Beam, Part, MeshPart, ParticleEmitter, Decal, and Texture. Other classes in the tree are left untouched.\r\n\r\nDecals and textures keep their own Transparency and still show on a part at 1, so they fade alongside it.\r\n\r\nA CanvasGroup is faded through `GroupTransparency` alone. Its descendants are not tracked, so objects added inside the group later still fade with it.\r\n\r\nA ViewportFrame is faded through `ImageTransparency`, which covers the world it draws. Parts, beams, particle emitters, decals and textures inside a viewport are not tracked.\r\n\r\n## API\r\n\r\n### Transparency.new(targetObject, options)\r\n\r\nCaches the transparency properties of the target and its descendants and returns a new object.\r\n\r\nPass `{ TrackNewDescendants = true }` to keep the cache in step with the tree. A descendant added later is learned as it is when added and brought to the current transparency, so add it in its resting state. A descendant removed is put back to its defaults and forgotten, so it can come back later without a fade baked in.\r\n\r\n### Transparency:Set(transparency)\r\n\r\nApplies a transparency from 0 to 1 across every cached object, where 0 keeps the original values and 1 is fully transparent.\r\n\r\n### Transparency:Exempt(exemptedObject)\r\n\r\nRestores the object and its descendants to their original values and stops tracking them, so later `Set` calls no longer affect them. With `TrackNewDescendants`, anything added under the object later stays untracked too.\r\n\r\n### Transparency:UpdateDefaults(object, ignoreDescendants)\r\n\r\nReads the current transparency of the object as its new default. Pass `true` for `ignoreDescendants` to update only the object itself. An exempted object is tracked again.\r\n\r\n### Transparency:Destroy()\r\n\r\nClears the cache and stops tracking new descendants. Objects keep their current transparency.\r\n","readmeTruncated":false}