DynamicTween [Open-Source] - Tween Anything

DynamicTween Release [v2]

  • Note: This module was initially created for personal use but has been open-sourced. Feel free to leave feedback.

Overview

DynamicTween replicates Roblox’s TweenService, adding Bezier curve support for advanced movement animations.
It specializes in dynamic animations for Roblox instances.

Features

  • Familiar Interface: Functions similarly to TweenService:Create(...) for creating tweens on Roblox instances.
  • Bezier Curve Support: Allows you to create natural motion paths with Bezier curves.
  • Dynamic Tweening: Specialized support for smooth animations of moving positions.
  • Model Tweening: Allows you to tween models, using :PivotTo()

Example Usages

Example 1 | Basic Tween for Position
local DynamicTween = require(path.to.DynamicTween)

local part = workspace.Part -- Replace with your part
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)

local propertyTable = {
	Position = Vector3.new(0, 10, 0) -- Move part to this position
}

local tween = DynamicTween:Create(part, tweenInfo, propertyTable, { Play = true })
Example 2 | Tween with Bezier Curve
local DynamicTween = require(path.to.DynamicTween)

local part = workspace.Part -- Replace with your part
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

local propertyTable = {
    Position = Vector3.new(20, 10, 20) -- End position
}

local curveOffset = Vector3.new(10, 15, 0) -- Control point for Bezier curve

local tween = DynamicTween:Create(part, tweenInfo, propertyTable, { Play = true, Curve = curveOffset })
Example 3 | Tweening Model Pivot Using CFrame
local DynamicTween = require(path.to.DynamicTween)

local model = workspace.Model -- Replace with your model
local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local propertyTable = {
    CFrame = CFrame.new(Vector3.new(20, 0, 20)) -- Move model to this CFrame
}

local tween = DynamicTween:Create(model, tweenInfo, propertyTable, { Play = true })
Example 4 | Pausing and Resuming Tween
local DynamicTween = require(path.to.DynamicTween)

local part = workspace.Part -- Replace with your part
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)

local propertyTable = {
    Position = Vector3.new(10, 20, 10)
}

local tween = DynamicTween:Create(part, tweenInfo, propertyTable, { Play = true })

wait(2) -- Let the tween run for 2 seconds
tween:Pause() -- Pause the tween

wait(2) -- Wait before resuming
tween:Play() -- Resume the tween

Methods, Properties & Events

For more details on the methods, properties, and events supported, refer to the TweenService Documentation.


Get the Model Here

Feel free to leave suggestions or report bugs. I’ll address them as quickly as possible.

13 Likes

Currently working on a big Update, (more optimization) and

  • Support for models
  • Support for RepeatCount, Reverse & DelayTime in the ConnectHeartbeat (Dynamic Tween) function

If you are currently using the V1, some things will change, Other.IsMoving will be removed. You can directly pass an instance as the Value or CFrame & Position.

2 Likes

_ V2 Just Released _

Changelog:
- [17/09/2024]: Changed, removed and added some new arguments.
- [17/09/2024]: Added support for Models, and the other TweenInfo arguments.

2 Likes

this seems very helpful glad u made this :+1:

2 Likes

I love making open-sourced modules, if you have any suggestions for this or another module feel free to a suggestion here

2 Likes

ooh yeah I think a good tween library should focus on animation algorithms or general timing that is the main feature missing from the native tweening library so seeing bezier curve here is cool. A custom tweening function I made for my boids library is one that is designed for navigation whereas the block moves a short distance on the path and faces the direction of movement before continuing instead of interpolating the turning angle for the entire distance of movement.

Seems pretty cool, been looking for a tween module to standardize my stuff, thanks.

1 Like