🕹️
AE Expressions
  • What is AE Expressions?
  • Getting started with Expressions
    • Useful links
    • After Effects - Quick Expressions Library
  • Quick Tips
    • After Effects - Arm Rig
    • After Effects - Liquid Smear
    • After Effects - Dynamic Shadows
    • After Effects - Dot Display
    • After Effects Expression - Computer Type-on Animation
    • After Effects Expression - Align Elements on a Path
    • After Effects Expression - Inertial Rotation
    • After Effects Expression - Force Field
  • Advanced Projects
  • After Effects - School of Fish
  • After Effects Expression - Global Wind Controller
  • After Effects Expression - Dynamic Line Waves
  • After Effects - Abstract Space Scene
  • After Effects Expression - Connected Dots
Powered by GitBook
On this page

Was this helpful?

After Effects Expression - Global Wind Controller

With this method, you'll be able to control the movement of several plants according to the wind's direction and speed.

PreviousAfter Effects - School of FishNextAfter Effects Expression - Dynamic Line Waves

Last updated 4 years ago

Was this helpful?

Full step by step Tutorial:

Code for Bend property:

let windSpeed = thisComp.layer("WIND CONTROLLER").effect("wind speed")("Slider");
let indexByPos = linear(position[0], 0, thisComp.width, 0.7, 1.7);

Math.sin((time-indexByPos)*Math.PI*windSpeed/10)*windSpeed*2;

/*
Expression by Francisco Giordano, August 2020.
Free for personal use and commercial use.
Instagram @ae.fran.giodano - frangiordano96@gmail.com
*/

For the Start and End properties, you'll have to apply different expressions depending on the type of your layer:

Code for Start property:

transform.position

Code for End property:

[position[0], position[1]-thisComp.height/2];

Code for Start property:

let myRect = sourceRectAtTime();
[myRect.width/2, myRect.height];

Code for End property:

let myRect = sourceRectAtTime();
[myRect.width/2, -myRect.height];

Code for Rotation property:

let windDirection = thisComp.layer("WIND CONTROLLER").effect("wind direction")("Angle");
let indexByPos = linear(position[0], 0, thisComp.width, 0.5, 1.5);
let windSpeed = thisComp.layer("WIND CONTROLLER").effect("wind speed")("Slider");

let sinRotation = Math.sin((time-indexByPos)*Math.PI*windSpeed/10)*windSpeed/2;
let windRotation = linear(windDirection.valueAtTime(time-indexByPos), 90, -90, windSpeed, -windSpeed);

sinRotation + windRotation;

/*
Expression by Francisco Giordano, August 2020.
Free for personal use and commercial use.
Instagram @ae.fran.giodano - frangiordano96@gmail.com
*/