jjjbad
(jjjbad)
April 10, 2021, 2:23pm
#1
How would I come about animating a slider toggle you’d find in your settings app, for dark and light mode, where there’s a smooth animation in the slider.
(I don’t care about changing the color of the background and stuff rn)
*moved to scripting section as I feel this is more to do with scripting
4 Likes
You would use tween service for this.
1 Like
You’d use TweenService, though when tweening because it’s a 2d object don’t use Vector3 instead use Udim2
2 Likes
jjjbad
(jjjbad)
April 10, 2021, 3:28pm
#4
Can I guess, tween colors, from (rgb) 45, 45, 45 to 20, 200, 20 for example?
Yes you can tween the colors to have it transition smoothly
jjjbad
(jjjbad)
April 11, 2021, 11:15am
#6
Can I get a guide for this, on the dev hub maybe?
Did this happen to help you? If not I could help you more
jjjbad
(jjjbad)
April 11, 2021, 1:30pm
#9
I am still doing some testing.
Minecrablox
(Minecrablox)
December 23, 2021, 12:27am
#11
Hello!
You can simply learn the mechanism behind horizontal or vertical slider math here:
Then you should be able to replace the direction positioning with tween service for much smoother results.
According to the forum example he provided:
bar.Size = UDim2.new(0, as.X, 1, 0)
This could be turned into a tween instead for a cool animation effect.
game:GetService("TweenService"):Create(bar,--TweenInfo Here--, {Size = UDim2.new(0, as.X, 1, 0)})
Let me know if you found this example helpful for trying to test out your UI magic.
(Also, try learning about the components of tweeninfo in order to experience what other animations/styles you could do with it.)