主题
EasingStyle
概览
| 字段 | 值 |
|---|---|
| Kind | Enum · 枚举 Enum |
| Realm | common |
- Inherit:
Int - 继承链:
Int→ EasingStyle
EasingStyle 是补间缓动曲线枚举,用来描述属性在补间过程中从起点过渡到终点时速度变化的节奏风格,提供 Enums.EasingStyle.Linear、Enums.EasingStyle.Sine、Enums.EasingStyle.Cubic、Enums.EasingStyle.Back、Enums.EasingStyle.Bounce、Enums.EasingStyle.Elastic 等成员。它通常与 EasingDirection 搭配使用,共同决定最终的补间曲线表现。
适用场景
在需要让物体位移、旋转或界面元素过渡时,用 Enums.EasingStyle 成员为补间指定节奏感,例如让旋转以回弹或弹跳的方式收尾。
使用要点
先通过 game:GetService("TweenService") 取得补间服务,再用 TweenInfo.New(时长, Enums.EasingStyle.Cubic, Enums.EasingDirection.InOut) 组装补间参数,接着调用 TweenService:Create(目标对象, 补间参数, 目标属性表) 得到补间对象,最后调用该对象的 Play 方法启动播放。引用时一律写成 Enums.EasingStyle.成员名 的完整形式。
注意事项
EasingStyle 与 EasingDirection 共同决定补间曲线;EasingDirection 有默认值,未显式传入时仍会按当前默认方向生效。枚举成员必须使用 Enums.EasingStyle 前缀,不能用裸名称或数字代替。
枚举值
| 值 | 名称 | 说明 |
|---|---|---|
0 | Linear | 线性 |
1 | Quad | 二次曲线 |
2 | Cubic | 三次曲线 |
3 | Quart | 四次曲线 |
4 | Quint | 五次曲线 |
5 | Sine | 正弦曲线 |
6 | Exponential | 指数曲线 |
7 | Circular | 圆弧曲线 |
8 | Back | 回弹效果 |
9 | Bounce | 弹跳效果 |
10 | Elastic | 弹性效果 |
