# How to tween a part at a constant rate

When you are tweening something you always put a number as to how fast you want it to animate to the destination but is there a way to make it so its constant speed animation because the farther something is to its destination then it starts fast and slows down at the end

You then have to set the easing style to `Linear` and easing direction as `InOut`.

well, i think you need to do some maths to calculate how much time does it need to tween it like the normal way.(i donâ€™t know honestly how to use maths in Roblox Studio very much)

to make something like a gun. when shooting, the bullet it will go where the mouse hits it.

Use linear easing style in your tweens

``````seconds = 3 -- How fast do you want the tween to go
Time = distance / seconds.
TweenInfo.new(Time,Enum.EasingStyle.Linear)
``````

This is linear, it is both same speed at the start and end

1 Like

would it be constant and not start fast and end slow

It is linear so yes. Also the speed will always be the same no matter how far the tween is
Lets say 20 studs, that is gonna take 20/3 seconds or around 6.67 seconds. Or maybe 15 studs, 15/3 = 5 seconds.

Remember to change the seconds to whatever you like

wdym 20/3 why 6.67 sec? can I make my own time

yes, you can change `3` to anything you want. The higher the number, the faster the speed of the tween

wat does InOut mean? can it be only In or only Out?

The `InOut` EasingDirection is where the easing occurs. Letâ€™s say the easing is Bounce, that means `InOut` will bounce in the start and in the end. Or maybe no `In` just `Out`, then it will only bounce in the end

Here are the lists of all the types of Easings

but wat is the 6.67? isnt the 3 supposed to be speed?

No, 3 is supposed to change the speed. Like I said, the seconds is not really the seconds it takes to finish, it modifies the speed instead. The distance is the dynamic one in the speed of the tween

``````Speed = 3 -- How fast do you want the tween to go
Time = distance / Speed.
TweenInfo.new(Time,Enum.EasingStyle.Linear)
``````

I changed it, so you understand

2 Likes

Anyways, if you want a constant animation, do this `TweenInfo.new(1, Enum.EasingStyle.Linear)`.
If you want a constant speed, use this