[Community Resource] TweenSequence Module: Tween NumberSequence and ColorSequence

Hey everyone! I have a little something for you guys to use!

Description:

The TweenSequence module provides an efficient way to tween NumberSequence and ColorSequence properties in Roblox using TweenService. This module simplifies the process of smoothly transitioning between keypoint values.

Features:

  • Smooth Tweening: Tween NumberSequence and ColorSequence properties seamlessly, interpolating between keypoints.
  • Simple API: Create tween by using TweenSequence.new(instance, property, tweenInfo, startSequence, endSequence)
  • Efficient Resource Management: Automatically handles the cleanup of tweening drivers and connections once the tween completes, ensuring minimal resource usage.
  • Customizable Timing: Customize the duration, easing style, and other properties of the tween to fit your animation needs.

Example Use Case:

local TweenNumberSequence = require(script.Parent.Parent.Parent.Parent)

local uigradient = script.Parent -- Example instance
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut,-1,true)

local colorStartSequence = uigradient.Color

local colorEndSequence = ColorSequence.new({
	ColorSequenceKeypoint.new(0, Color3.new(1, 0.705882, 0.113725)),
	ColorSequenceKeypoint.new(1, Color3.new(0.184314, 1, 0.184314)),
})

local numberStartSequence = uigradient.Transparency

local numberEndSequence = NumberSequence.new({
	NumberSequenceKeypoint.new(0,1),
	NumberSequenceKeypoint.new(1,0),
})

local tween = TweenNumberSequence.new(uigradient, "Color", tweenInfo, colorStartSequence, colorEndSequence)
local tween2 = TweenNumberSequence.new(uigradient, "Transparency", tweenInfo, numberStartSequence, numberEndSequence)
tween:Play()
tween2:Play()

Why Use This Module?

  • Simplified Tweening: Easily tween NumberSequence and ColorSequence properties without complex code.
  • Efficient and Clean: Reduces the need for multiple tween objects, keeping your code clean and efficient.
  • Automatic Cleanup: Ensures resources are properly cleaned up once the tween completes, preventing memory leaks.

This module is ideal for developers looking to tween NumberSequence and ColorSequence properties with ease, providing smooth transitions and an efficient workflow. Feel free to contribute, provide feedback, or improve the module!
Anyways, here’s the Module
If you want, you can Donate Here!

Also, If you have some time, please reply with what you think!