# TweenService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/TweenService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/TweenService

Used to create `Tweens` which interpolate, or tween, the properties of instances.

## Methods

### Create

```luau
TweenService:Create(instance: Instance, tweenInfo: TweenInfo, propertyTable: { [string]: any }): Tween
```

- Tags: Capabilities: Basic

Creates a new [`Tween`](https://rapi.sleaze.dev/classes/Tween.md) given the object whose properties are to be tweened, a [`TweenInfo`](https://rapi.sleaze.dev/index/types/TweenInfo.md), and a dictionary of goal property values.

Parameters:

- `instance`: The [`Instance`](https://rapi.sleaze.dev/classes/Instance.md) whose properties are to be tweened.
- `tweenInfo`: The [`TweenInfo`](https://rapi.sleaze.dev/index/types/TweenInfo.md) to be used.
- `propertyTable`: A dictionary of properties, and their target values, to be tweened.

Returns: The newly created [`Tween`](https://rapi.sleaze.dev/classes/Tween.md) configured to interpolate the given properties toward their target values. Call [`TweenBase:Play()`](https://rapi.sleaze.dev/classes/TweenBase.md) on the returned object to start the tween.

### GetValue

```luau
TweenService:GetValue(alpha: number, easingStyle: Enum.EasingStyle, easingDirection: Enum.EasingDirection): number
```

- Tags: Thread safe, Capabilities: Basic, Simulation access

Calculates a new alpha given an `EasingStyle` and `EasingDirection`.

Parameters:

- `alpha`: An interpolation value between `0` and `1`.
- `easingStyle`: The easing style to use.
- `easingDirection`: The easing direction to use.

Returns: A new alpha value generated from the given easing style and direction.

### SmoothDamp

```luau
TweenService:SmoothDamp(current: any, target: any, velocity: any, smoothTime: number, maxSpeed: number?, dt: number?): (any, any)
```

- Tags: Thread safe, Capabilities: Basic, Simulation access

Smoothly interpolates a value towards a target, simulating a critically damped spring.

Parameters:

- `current`: The current value to smooth.
- `target`: The target value to reach.
- `velocity`: The current velocity with which the current value should approach the target value. You shouldn't modify this value between calls yourself, it's used to store the stateful velocity. In most cases, initialize this with `0`, `zero`, `zero`, or `identity` depending on the type, or if needed, with your initial velocity.
- `smoothTime`: The duration over which the total smoothing operation should take place. Note that since this is a damped spring, there's no guarantee `current` will be exactly `target` after this time, but it will be close. Smaller values result in quicker smoothing.
- `maxSpeed`: The maximum speed at which the current value should approach the target value. Leaving this nil defaults to `huge`, meaning the velocity isn't clamped.
- `dt`: The rate at which the smoothing operation should be applied. If left nil, the current engine delta time will be used.

Returns: The new value and new velocity calculated from the smoothing operation.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
