Skip to content
Ryan edited this page Apr 8, 2023 · 10 revisions

Documentation for the Shime module. Shime is a class that allows you to create a shimmer effect on any GuiObject on Roblox. Based off of Roblox's Shimmer module from CoreGui.

Summary

Constructors

new(parent: GuiObject)
Returns a table containing Shimmer's metatable. Shimmers using default parameters.
new(parent: GuiObject, time: number?, style: EasingStyle?, direction: EasingDirection?, repeatCount: number?, reverses: boolean?, delayTime: number?)
Returns a table containing Shimmer's metatable. Shimmers using specified parameters.

Properties

Property Details
PlaybackState: Enum.PlaybackState This read-only property will return Enum.PlaybackState.

Methods

GetFrame(): Frame
The GetFrame function returns the Frame that is used to create the shimmer effect. This frame can be customized after the shimmer is created.
GetGradient(): UIGradient
The GetGradient function returns the UIGradient that is used to create the shimmer effect. This gradient can be customized after the shimmer is created.
Stop(): void
The Stop function halts Shimmer. If Shimmer:Play() is called again the Shimmer will resume interpolating towards their destination but take the full length of the time to do so.
Pause(): void
The Pause function halts Shimmer. If you call Shimmer:Play() again, the shimmer resumes playback from the moment it was paused.
Play(): void
The Play function starts Shimmer. Note that if a shimmer has already begun calling Play will have no effect unless the shimmer has finished or has been stopped (either by Shimmer:Stop() or Shimmer:Pause()).

Constructors

new

Creates a new Shimmer from the provided parameters.

Parameters

Parameter Details
parent: GuiObject
time: number? Default Value: "1"
style: EasingStyle? Default Value: "EasingStyle.Linear"
direction: EasingDirection? Default Value: "EasingDirection.In"
repeatCount: number? Default Value: "-1"
reverses: boolean? Default Value: "false"
delay: number? Default Value: "0"

Properties

PlaybackState

This read-only property will return Enum.PlaybackState.

This property is updated when the playback of the Shimmer is updated. This can be caused by a method changing the Shimmer, the Shimmer finishing, etc.

As PlaybackState is read only it can not be used to change the playback of the Shimmer.

Code Samples

This code sample contains demonstrates when the Shimmer.PlaybackState property is updated and how to utilize it.

A shimmer is created and played. Every 1 second the shimmer is paused then played again. The PlaybackState property is then printed to the output.

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Loop shimmers play and pause every 1 second
while true do
	task.wait(1)
	if shimmer.PlaybackState == Enum.PlaybackState.Playing then
		-- Pause the shimmer and print PlaybackState
		shimmer:Pause()
		print("shimmer.PlaybackState: " .. tostring(shimmer.PlaybackState))
	elseif shimmer.PlaybackState == Enum.PlaybackState.== Enum.PlaybackState.Playing then
		-- Play the shimmer and print PlaybackState
		shimmer:Play()
		print("shimmer.PlaybackState: " .. tostring(shimmer.PlaybackState))
	end
end

Methods

GetFrame

The GetFrame function returns the Frame that is used to create the shimmer effect. This frame can be customized after the shimmer is created.

Returns

Frame

Code Samples

This code sample contains demonstrates how to customize the Frame that is used to create the shimmer effect.

A shimmer is created and played. The Frame that is used to create the shimmer effect is then customized.

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Customize the Frame that creates the shimmer effect
local shimmerFrame = shimmer:GetFrame()
shimmerFrame.BackgroundTransparency = 0.5

GetGradient

The GetGradient function returns the UIGradient that is used to create the shimmer effect. This gradient can be customized after the shimmer is created.

Returns

UIGradient

Code Samples

This code sample contains demonstrates how to customize the UIGradient that is used to create the shimmer effect.

A shimmer is created and played. The UIGradient that is used to create the shimmer effect is then customized.

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Customize the UIGradient that creates the shimmer effect
local shimmerGradient = shimmer:GetGradient()
shimmerGradient.Rotation = 90

Stop

Stops the Shimmer. Sets Shimmer.PlaybackState to Enum.PlaybackState.Cancelled.

Returns

void

Code Samples

This sample gives a simple demonstration of what each of the Shimmer functions (Shimmer.Play, Shimmer.Stop and Shimmer.Pause).

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Pause the Shimmer when the mouse enters the GuiObject
script.Parent.MouseEnter:Connect(function()
	shimmer:Pause()
end)

-- Stop the Shimmer when the mouse leaves the GuiObject
script.Parent.MouseButton1Click:Connect(function()
	shimmer:Stop()
end)

Pause

Pauses the Shimmer. Sets Shimmer.PlaybackState to Enum.PlaybackState.Paused.

Returns

void

Code Samples

This sample gives a simple demonstration of what each of the Shimmer functions (Shimmer.Play, Shimmer.Stop and Shimmer.Pause).

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Pause the Shimmer when the mouse enters the GuiObject
script.Parent.MouseEnter:Connect(function()
	shimmer:Pause()
end)

-- Stop the Shimmer when the mouse leaves the GuiObject
script.Parent.MouseButton1Click:Connect(function()
	shimmer:Stop()
end)

Play

Plays the Shimmer. Sets Shimmer.PlaybackState to Enum.PlaybackState.Playing.

Returns

void

Code Samples

This sample gives a simple demonstration of what each of the Shimmer functions (Shimmer.Play, Shimmer.Stop and Shimmer.Pause).

-- Require the Shime module
local Shime = require(game.ReplicatedStorage.Shime)

-- Create a new Shimmer and play it
local shimmer = Shime.new(script.Parent)
shimmer:Play()

-- Pause the Shimmer when the mouse enters the GuiObject
script.Parent.MouseEnter:Connect(function()
	shimmer:Pause()
end)

-- Stop the Shimmer when the mouse leaves the GuiObject
script.Parent.MouseButton1Click:Connect(function()
	shimmer:Stop()
end)