百姓心情网-为你提供各类经典名言与文案句子

ae弹性表达式

AE(After Effects)中的弹性表达式是一种强大的工具,用于在关键帧动画中添加弹性效果,使得物体在运动过程中产生类似弹簧的反弹效果。以下是一些基本的弹性表达式示例,以及它们的作用:

弹性表达式基本格式

```plaintext

amp = 初始振幅

freq = 频率(每秒弹动的次数)

decay = 衰减(决定弹性效果持续的时间)

n = 关键帧的数量

if (n == 0) {

value = 初始值

} else {

t = 当前时间 - 最近关键帧的时间

if (t > 0) {

v = 在关键帧时间点的速度

value += v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t)

} else {

value = 初始值

}

}

```

应用弹性表达式

位置弹性

```plaintext

posX = position.x + (position.x - lastPosition.x) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

posY = position.y + (position.y - lastPosition.y) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

```

缩放弹性

```plaintext

scaleX = scale.x + (scale.x - lastScale.x) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

scaleY = scale.y + (scale.y - lastScale.y) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

```

旋转弹性

```plaintext

rotationX = rotation.x + (rotation.x - lastRotation.x) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

rotationY = rotation.y + (rotation.y - lastRotation.y) * Math.sin(freq * (time - lastTime) * 2 * Math.PI) / Math.exp(decay * (time - lastTime))

```

注意事项

弹性表达式适用于位置、缩放、旋转等属性,但不适用于所有属性,例如颜色属性。

参数 `amp`、`freq` 和 `decay` 可以根据实际需要调整,以获得理想的弹性效果。

弹性表达式在关键帧动画中应用,可以创建复杂的运动路径和动态效果。

以上是AE中弹性表达式的基本知识和应用示例。

上一篇上一篇:比重单位

下一篇下一篇:没有了