Tweening a color using EasingStyle Back makes “back” moment of the curve unexpected colors instead of clamping, due to Color3 overflow/underflow rules.
When dealing with Tween for color, when the value exceed 1, it will reset to zero, leading to graphic incoherence when merging this behavior with the Back easing style. It’s the same when the value is negative, the values comes back to the far edge.
This leads to visual incoherence for the user when dealing with tweens for example. Here is the code used:
--!strict
local TweenService = game:GetService("TweenService")
local myPart = script.Parent
myPart.Color = Color3.new(.3, .3, .3) -- from gray...
local myTween = TweenService:Create(myPart, TweenInfo.new(1, Enum.EasingStyle.Back), {
Color = Color3.new(1, 0, 0) -- ... to red
})
task.delay(5, myTween.Play, myTween)
and here is a video to show the behavior:
this is not a real problem with the engine since it’s the “expected” behavior, but this post is either to make a special case for the tween, or change the way Color3 overflow/underflow is handled, since it’s not right for a user.
Expected behavior
Expected behavior would be clamped values (maxed out to 1, and the less you can have is 0) but right now, the values reset to 0 from the beginning when it’s too high, and goes back to 1 when it’s too low.
this example on the “Run a command”:
local x = Instance.new("Part"); task.defer(x.Destroy, x); print(Color3.new(1.1)); x.Color = Color3.new(1.1); print(x.Color)
actual behavior:
16:20:55.074 1.1, 0, 0 - Edit
16:20:55.075 0.0941176, 0, 0 - Edit
expected behavior:
16:20:55.074 1.1, 0, 0 - Edit
16:20:55.075 1, 0, 0 - Edit
another behavior could be revert values, so the overflow (here 0.1) is substract to the value like that:
16:20:55.074 1.1, 0, 0 - Edit
16:20:55.075 0.9, 0, 0 - Edit
this makes the back tween more smoother on the transition with Back for example.
here is an example of what it can look like with Back
A private message is associated with this bug report