Hey guys, I’ve been cooking something lately for use in my other module, but I feel like it’s worthy to be released as a separate entity. So here’s SpringV2 as its own module, independently released (although still developed in the same game).
It’s a complete rewrite of my Spring module which was very janky (and was never posted here, just sitting the background). Instead of a 1D spring, it now has multiple dimensions it can work with, and the results are pretty solid to me.
I know that other spring modules already exist, but it’s nice to have alternatives. This module aims for simplicity, so people can easily use it.
With that out of the way, let’s just continue with the specifications.
Key features:
- Tweening instances’ properties with configurable springs.
- Nth dimensional springs for many supported data types.
- Automatically switches to deferred mode when performance dips below a certain threshold or when doing too many spring calculations.
- Spring parameters are slightly similar to SwiftUI’s spring implementations (the main inspiration to making this module in the first place), and uses just two variables, which are
durationandbounces.durationcontrols the duration of the spring tween, andbouncescontrol how much half-oscillations the spring does.
Primary APIs:
-
module:tween(instance, springInfo:springInfo, propertyTable:{any}):
Tweens the instance’s properties to the propertyTable given, with the springInfo configuration. -
module:springInfo(duration:number?, bounces:number?):
Helper function to create a springInfo table. -
tweenObject.stop():
Stops a tween object. -
tweenObject.getCompletedSignal(propertyKey:string):
Gets a completed signal for a property currently tweened.
Get the thing:
You can get the module here, and the test place is the exact same place as that other module
You can request a suggestion or maybe report a problem by posting it here. I’ll probably implement or fix it.