No idea why this isn’t an enum yet. There’s an enum for every single easing style from the animation editor but there isn’t one for constant.
If by constant you mean Linear, there already is one. If you mean a constant, you don’t need to tween, just lerp/set your value depending on what you need
There is, it’s called Linear instead of constant (presumably because if you were to graph the easing function it’s just linear, as in a line, meaning a constant change throughout).
I assume by Animation Editor you mean the easing styles you can apply to each keyframe; the reason there’s an option for “Constant” is because the animation system interpolates between keyframes by default, so there’s a seperate easing style in the rare(ish) case an animator needs the keyframe to be snapped to without interpolation. This is unnecessary programmatically,as @MintSoapBar, because there’s no use creating a tween when you aren’t interpolating anything, you’d just directly change the parameter.
See the creator hub for more information.
This is the code for constant:
local function constant(alpha: number)
return alpha >= 1 and 1 or 0
end
Always returns zero until the alpha is greater than one.
An enum is required for the sole purpose of consistency. There is no current way to identify an easing style as constant without using strings, which shouldn’t be the case.
The animation editor is the exception, not the standard; all other tweening processes don’t include or need a constant easing style. The only reason it is implemented in the Animation Editor is for the sake of extending the animator’s control over the animation, it serves no real practical purpose to have it and thus is only implemented where it is needed.
I do see a reason for this to be added. Why this confusion between Linear and Constant? They’re different.
There was confusion because there really is no practical reason for it to be implemented as a seperate easing style, so naturally we assumed the author meant a constant rate (aka linear) of change instead of what they really meant.
There is a use purpose.
Constant keyframes are a great way to simulate impact and speed, thus it becomes crucial for it to be an easing type. Thus, if you want to create your own animation reader for your own purposes, you are restricted to using strings (not preferable as it uses much more memory than an enum) and are not compatible to be used in TweenInfo
constructors.
local animationData = {
{
value = Vector3.new(0, 0, 0),
style = Enum.EasingStyle.Sine,
direction = Enum.EasingDirection.Out
},
{
value = Vector3.new(1, 1, 1),
style = Enum.EasingStyle.Constant, --> whoops! This doesn't exist
direction = Enum.EasingDirection.Out
},
{
value = Vector3.new(4, 4, 4),
style = Enum.EasingStyle.Quad,
direction = Enum.EasingDirection.Out
},
}
Wouldn’t it be far less confusing to just use an already established constant delay like coroutines or task.delay
? I really don’t see the practical application of this but maybe I’m wrong.
If I were to write an interpreter for the data structure I showed above, not only do I have to change how the data structure is formatted, I would have to do redundant checks to achieve the desired behaviour.
With constant easing style:
local animationData = {
{
value = Vector3.new(0, 0, 0),
style = Enum.EasingStyle.Sine,
direction = Enum.EasingDirection.Out,
},
{
value = Vector3.new(1, 1, 1),
style = Enum.EasingStyle.Constant,
direction = Enum.EasingDirection.Out,
},
{
value = Vector3.new(4, 4, 4),
style = Enum.EasingStyle.Quad,
direction = Enum.EasingDirection.Out,
},
}
for _, keyframe in animationData do
local easingFunction = easingFunctions[keyframe.style.Name][keyframe.direction.Name]
-->> other animation stuff
end
Without constant easing style:
local animationData = {
{
value = Vector3.new(0, 0, 0),
style = Enum.EasingStyle.Sine,
direction = Enum.EasingDirection.Out,
},
{
value = Vector3.new(1, 1, 1),
style = "Constant", --> look at this monstrous inconsistency!
direction = Enum.EasingDirection.Out,
},
{
value = Vector3.new(4, 4, 4),
style = Enum.EasingStyle.Quad,
direction = Enum.EasingDirection.Out,
},
}
for _, keyframe in animationData do
local easingFunction
if animationData.style == "Constant" then --> this should be redundant
easingFunction = easingFunctions["Constant"][keyframe.direction.Name]
else
easingFunction = easingFunctions[keyframe.style.Name][keyframe.direction.Name]
end
-->> other animation stuff
end
There is no point in creating another thread using task.delay
. That’s just bad, inconsistent practice.
I see, so the main reason for the suggestion is to make it easier for animation data to be ported in an organized manner if I understand correctly?
I agree. I believe it is already under a different enumeration, but is not accepted by TweenService yet.
In all fairness, if I were to implement this myself, I’d make the easing styles and directions (alpha transformers) a table of functions, in separate modules, and reference them directly in the data table, rather than nesting them and trying to index them with enums
I’d argue that this is a bug, not a feature request.
Support.
I shouldn’t be forced to use Lerp or CFrame:ToWorldSpace() to do any of this.
And I agree with your arguments about what you’ve said in the replies. @VegetationBush
The fact Roblox doesn’t have this baffles me.
It’s a pose easing style. The enum is Enum.PoseEasingStyle.Constant. They don’t use Enum.EasingStyle for animation poses