Drop Shadow Multi

After Effects
April 4, 2025

/*
This script generates a random color and applies
it to the fill property of the selected shape
layer in Adobe After Effects. It ensures that
each selected shape layer gets a unique color.
*/


// Get the selected layers
var selectedLayers = app.project.activeItem.selectedLayers;

if (selectedLayers.length > 0) {
   app.beginUndoGroup("Apply Drop Shadow");

   // Convert selectedLayers to an array and sort by index in ascending order
   var layers = [];
   for (var i = 0; i < selectedLayers.length; i++) {
       layers.push(selectedLayers[i]);
   }
   layers.sort(function(a, b) {
       return a.index - b.index;
   });

   // The topmost layer (lowest index) is the first in the sorted array
   var topLayer = layers[0];
   var controlLayerName = topLayer.name;

   // Apply drop shadow effect to the control layer
   var dropShadow = topLayer.property("Effects").addProperty("Drop Shadow");
   dropShadow.property("Opacity").setValue(40);
   dropShadow.property("Softness").setValue(250);
   dropShadow.property("Direction").setValue(0);
   dropShadow.property("Distance").setValue(0);

   // Apply drop shadow effect to other layers and link properties to the control layer
   for (var i = 1; i < layers.length; i++) {
       var layer = layers[i];
       var layerDropShadow = layer.property("Effects").addProperty("Drop Shadow");
       layerDropShadow.property("Opacity").expression = 'thisComp.layer("' + controlLayerName + '").effect("Drop Shadow")("Opacity")';
       layerDropShadow.property("Softness").expression = 'thisComp.layer("' + controlLayerName + '").effect("Drop Shadow")("Softness")';
       layerDropShadow.property("Direction").expression = 'thisComp.layer("' + controlLayerName + '").effect("Drop Shadow")("Direction")';
       layerDropShadow.property("Distance").expression = 'thisComp.layer("' + controlLayerName + '").effect("Drop Shadow")("Distance")';
   }

   app.endUndoGroup();
} else {
   alert("No layers selected. Please select at least one layer.");
}

How to use the script

Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.

Option 1: Install to your AE Folder

Download and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.

Option 2: Adapt the script yourself

Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.

How to use the script

Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.

Option 1: Install to your AE Folder

Download and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.

Option 2: Adapt the script yourself

Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.

Research, interviews, and tools for modern motion designers.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.