BezierTween 0.0.1 | A light-weight implementation of bezier curves with UI, Parts and more!

Before i start, i want to give credits to @bhristt, without his amazing module i wouldnt have made this module.

Original Post

This module is actually pretty simillar to his module, other than a few changes:

Old Method:

local Bezier = BezierModule.new(StartPos, LMidPos, RMidPos, EndPos);
local Tween = Bezier:CreateCFrameTween(workspace.Part, {'CFrame'}, TweenInfo.new(Duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0))
Tween:Play()

New Method

local ControlPoints = {{
		StartPos,
		LMidPos,
		RMidPos,
		EndPos: Vector3 | BasePart
	}}
local Tween = BezierTween.Create(workspace.Part, {1, 'Sine', 'Out'}, {CFrame = ControlPoints})
Tween:Play()
  • It works on UIs! now u can make some cool effects with this for example when u receive coins
  • Removal of some functions like AddBezierPoint and more
  • From what i’ve tested it should be same performance, but i think its pretty optimized
  • Cleaner Code
  • This was tested for stuff i needed, if u find any bugs tell me and i will fix them
API
--[[
	BezierTween
	
	By: ltsRealJr
	Credits: https://devforum.roblox.com/t/bhristts-bezier-curve-module-tween-support/1510751
	
	Version: 0.0.1

	This module uses TweenService to create animations using Bezier curves.
	Unlike regular tweens which only allow for start and end points,
	BezierTween enables you to define multiple control points for your animations
	
	Key features:

	- Create smooth transitions between multiple control points
	- Compatible with CFrame, Vector3, UDim, Color, and more
	- Provides familiar tween methods (Play, Pause, Cancel) and events (Completed)
	- Works on UI Objects and Non-UI objects
	- Accepts EndPos as BasePart

	Constructor:
	    BezierTween.Create(Object: Instance, Info: table | TweenInfo, Properties: table)
	        - Object: The instance whose properties will be tweened
	        - Info: Either a table of tween parameters [duration, EasingStyle, EasingDirection] or a TweenInfo object
	        - Properties: A table of properties to tween with their end values or control points

	Methods:
	    :Play()
	        - Starts or resumes the tween
	    
	    :Pause()
	        - Pauses the tween at its current position
	    
	    :Cancel()
	        - Cancels the tween and returns properties to their original values
	    
	    :Destroy()
	        - Cleans up the tween and removes all connections

	Events:
	    .Completed
	        - Signal that fires when the tween completes naturally

	Static Methods:
	    BezierTween.CleanupInstance(Object: Instance)
	        - Cleans up all tweens associated with the given object

	Examples:
	
	With no Control Points:
		local Part = workspace.Part
		local Tween = BezierTween.Create(Part, {1, 'Quad', 'Out'}, {
		    Position = Vector3.new(10, 10, 10)
		})
		Tween:Play()
		
	With Control Points:
		local Part = workspace.Part
		local StartPos = Part.Position
		local EndPos = StartPos
		local Tween = BezierTween.Create(Part, {1, 'Quad', 'Out'}, {
		    Position = {
		    	StartPos,
		    	StartPos + Vector3.new(0, 10, 0),
		    	EndPos
		    }
		})
		Tween:Play()
]]
Videos

BezierTween.rbxm (6.4 KB)

Any bugs? let me know! Ill fix them if i can

Previous Open Source:
OrbitCameraController
AnimatedListLayout

EDIT: After testing i found out that de casteljau’s method is actually faster than bernstein, so ill be working on updating it.

3 Likes