What is the difference between “lerping.” And “tweening.”? I don’t know the difference. they seem like they do the exact same thing but i don’t know the difference.
If you can tell me what the differences is and give me and an example of it. It would be so appreciated. Thanks before hand
Also question. Say ur making an fps game and ur making the aim script where u can ads. Would it be better to lerp or tween?
The TLDR is that tweening is computing intermediate values between two given values, using some manner of interpolation, which is not necessarily always Linear Interpolation.
Lerp is an abbreviation of linear interpolation, i.e. computing a value between two given values, on the straight line between them. It’s a common name for a helper function that computes an interpolated value between two given values, often as a function of those endpoints plus a parameter that is usually called t (a convention taken from parametric equations, and not necessarily time) that has a value from 0 to 1 inclusive, where the t value is where the point lies between the given points (t=0 is the starting point, t=1 is the end point, t=0.5 is half way between). The values can be any type which can be linearly interpolated, including scalars, vectors, etc. In the particular case of a CFrame, the Lerp function does something a bit special, it does a Slerp (spherical linear interpolation) of the rotation Matrix3 ‘orientation’ part (linearly interpolating the rotation angle if you consider of the change of orientation in its axis-angle form) and a normal linear interpolation of the position/translation component (a Vector3).
Tweening is a much more general term that is short for “in-betweening”. This originally comes from the world of classic cel animation (e.g. vintage Disney), where principal artists would draw every Nth frame of an animation (the “key” frames), and “in betweeners” (lower rank production artists) would draw the interpolated frames in between the key frames, to complete the animation at the desired framerate.
These days, “tweening” is applied to pretty much anywhere you can think of where some bit of code is computing the steps in between two given values, usually (but not always) over time. As noted above, interpolation is what is used to do this, but it’s not always linear interpolation. Particularly in UI, tweening often has a curve function that is remapping linear time to some acceleration profile. These curves are known as “easing” curves, because the most common use case is to use them to gradually ease in and out of full-speed motion, to give the look of something that’s accelerating and decelerating smoothly.
Lerp is linear interpolation and can achieve multiple movements type at the same time unlike tweening in which you have to configure a movement for a specific thing. Like with lerp() you can make a move that go from point x to point y while also achieving a cool rotation effect unlike tween in which you have to manually configure the properties of the object animation