forked from Roblox/creator-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweenService.yaml
More file actions
175 lines (170 loc) · 5.42 KB
/
TweenService.yaml
File metadata and controls
175 lines (170 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: TweenService
type: class
category: Animations
memory_category: Instances
summary: |
Used to create `Class.Tween|Tweens` which interpolate, or tween, the
properties of instances.
description: |
`Class.TweenService` is used to create `Class.Tween|Tweens` which interpolate,
or tween, the properties of instances. `Class.Tween|Tweens` can be used on any
object with compatible property types, including:
- [number](../../../luau/numbers.md)
- [boolean](../../../luau/booleans.md)
- `Datatype.CFrame`
- `Datatype.Rect`
- `Datatype.Color3`
- `Datatype.UDim`
- `Datatype.UDim2`
- `Datatype.Vector2`
- `Datatype.Vector2int16`
- `Datatype.Vector3`
- `Datatype.EnumItem`
`Class.TweenService:Create()`, the primary constructor function, takes
`Datatype.TweenInfo` specifications about the tween and generates the
`Class.Tween` object which can then be used to play the tween.
Note that `Class.Tween|Tweens` can interpolate multiple properties at the same
time, but they must not be interpolating the same property. If two tweens
attempt to modify the same property, the initial tween will be cancelled and
overwritten by the most recent tween.
code_samples:
- Tween-Creation
- Looped-Tween
- Tween-Pausing
inherits:
- Instance
tags:
- NotCreatable
- Service
deprecation_message: ''
properties: []
methods:
- name: TweenService:Create
summary: |
Creates a new `Class.Tween` given the object whose properties are to be
tweened, a `Datatype.TweenInfo`, and a dictionary of goal property values.
description: |
This constructor creates a new `Class.Tween` from three arguments: the
object to tween, the `Datatype.TweenInfo` specifications, and a table
containing the properties to tween and values to tween to.
The `propertyTable` parameter needs to be a dictionary where the keys are
the string names of the property (for example `Position`, `Transparency`,
or `Color`), and the values are the property targets at the end of the
tween.
The `Class.Tween` created using this function is unique to the object
given as the `instance` parameter. To apply the same tween to another
object, call this function again with the new object.
code_samples:
- Tween-Creation
- Looped-Tween
parameters:
- name: instance
type: Instance
default:
summary: |
The `Class.Instance` whose properties are to be tweened.
- name: tweenInfo
type: TweenInfo
default:
summary: |
The `Datatype.TweenInfo` to be used.
- name: propertyTable
type: Dictionary
default:
summary: |
A dictionary of properties, and their target values, to be tweened.
returns:
- type: Tween
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
writeCapabilities: []
- name: TweenService:GetValue
summary: |
Calculates a new alpha given an `Enum.EasingStyle` and
`Enum.EasingDirection`.
description: |
Returns a new alpha value for interpolating using the given alpha value,
`Enum.EasingStyle`, and `Enum.EasingDirection`. The provided `alpha` value
will be clamped between `0` and `1`.
code_samples:
parameters:
- name: alpha
type: float
default:
summary: |
An interpolation value between `0` and `1`.
- name: easingStyle
type: EasingStyle
default:
summary: |
The easing style to use.
- name: easingDirection
type: EasingDirection
default:
summary: |
The easing direction to use.
returns:
- type: float
summary: |
A new alpha value generated from the given easing style and direction.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
writeCapabilities: []
- name: TweenService:SmoothDamp
summary: |
Calculates a value simulating a critically damped spring.
description: |
Returns a tuple that allows smoothing a value towards a target, simulating
a critically damped spring. Supports `Datatype.Vector2`,
`Datatype.Vector3`, `Datatype.CFrame`, and number.
code_samples: []
parameters:
- name: current
type: Variant
default:
summary:
The current position.
- name: target
type: Variant
default:
summary:
The target position.
- name: velocity
type: Variant
default:
summary:
The initial velocity at which the current position should approach the target position.
- name: smoothTime
type: float
default:
summary:
The duration in which the total smoothing operation should take place.
- name: maxSpeed
type: float?
default:
summary:
The maximum speed at which the current position should approach the target position.
- name: dt
type: float?
default:
summary:
The rate at which the smoothing operation should be applied.
returns:
- type: Tuple
summary:
The new position and velocity calculated from the smoothing operation.
tags: []
deprecation_message: ''
security: None
thread_safety: Safe
capabilities: []
writeCapabilities: []
events: []
callbacks: []