Automate Beat‑Synced Opacity in After Effects with Expressions
Learn how to drive a layer’s opacity with audio amplitude using a simple After Effects expression, eliminating manual beat‑by‑beat keyframing.
28 Sept 2026, 22:16 UTC

Problem: Manually keyframing opacity to match a music beat is tedious
When you want a layer to pulse with each drum hit, the usual workflow is to place a keyframe on every beat, adjust the values, and then tweak the timing if the track changes. This approach scales poorly with longer songs or multiple layers, and any edit to the audio forces you to redo the keyframes.
Takeaway: Use an expression to drive opacity directly from audio amplitude
By linking a layer’s opacity to the audio amplitude data that After Effects can generate automatically, the animation updates at render time without extra keyframes. The result is a responsive beat‑synced effect that adapts instantly if you replace or edit the audio track.
Understanding the expression basics
Expressions are small JavaScript snippets that evaluate for each frame. They can read any animatable property, perform math, and return a value. For audio‑driven work the most useful building blocks are:
thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")– returns the current amplitude slider value (0‑100 by default).linear(t, tMin, tMax, value1, value2)– maps a source range to a target range.value– the property’s original value, useful when you want to add an offset.
These pieces let you turn raw amplitude into a usable opacity value (0‑100%).
Workflow: Convert audio to keyframes then apply the expression
- Import your music track and place it in the composition.
- Select the audio layer and choose Animation > Convert Audio to Keyframes. After Effects creates a new layer named “Audio Amplitude” with two effects: “Left Channel” and “Right Channel”, plus a “Both Channels” slider that mixes them.
- Create the layer you want to animate (e.g., a solid, shape, or text layer). Press T to reveal its opacity property.
- Alt‑click (Option‑click) the stopwatch next to Opacity to add an expression.
- Paste the following expression, replacing "Audio Amplitude" if your layer has a different name:
// Drive opacity from audio amplitude
amp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
// Map 0‑100 amplitude to 30‑100 opacity (so the layer never goes fully transparent)
linear(amp, 0, 100, 30, 100);
The expression reads the slider each frame, runs linear to convert the amplitude range to an opacity range, and returns that value. The layer now pulses in sync with the music.
Trade‑offs and limitations
- Preview performance: Expressions evaluate at render time. A simple expression like the one above adds negligible overhead, but if you stack many expressions or use heavy functions such as
sampleImage, RAM previews can slow down. - Debugging: Expression errors appear as yellow warning banners in the timeline. A missing parenthesis or typo will cause the expression to return the last valid value or zero, which can be confusing. Always check the Expressions tab for warning icons.
- Predictability: Because the value is calculated each frame, you cannot see the exact opacity curve in the Graph Editor unless you enable the expression’s “Show Post‑Expression Graph” option.
Actionable closing
Try the workflow on a short test clip: add a drum loop, convert to keyframes, apply the expression, and RAM preview. If the opacity does not pulse, verify that the audio layer name matches the expression and that the “Both Channels” slider is active (its value should change during playback). To revert to static opacity, simply click the equals sign next to the expression to disable it; the layer will return to the opacity value you set before adding the expression.
By replacing repetitive keyframing with a single expression, you keep your project flexible, reduce clutter, and make audio‑driven animations easier to maintain.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.