Expressions/Scripts/Presets

Moderator: byronnash

 
SFR75
Topic Author
Posts: 17
Joined: Tue Apr 03, 2007 10:49 am

Onion skin

Sun Dec 16, 2007 2:51 pm

To make onion-skin in After Effects.
For example you have a layer with mask animation.
When you run a script it duplicates the layer twice and shifts one layer a keyframe left and the other keyframe right. Then it puts both duplicate copies in mode Multiply and opacity 50.
So on the screen you see previous and next position.
How about that ? :)

I do it manually sometimes, but if a script could take care of this, that would be really great :)
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Mon Dec 17, 2007 1:38 am

Give this a try:
{
   var activeItem = app.project.activeItem;   
   // make sure a Comp is currently active
   if (activeItem == null || !(activeItem instanceof CompItem)){
         alert("Select one layer before running this script");
   } else {
      // make sure one layer is selected
      if (activeItem.selectedLayers.length != 1) {
            alert("Select one layer before running this script");
      } else {         
         var theLayer = activeItem.selectedLayers[0];
               
         // create duplicate layer, offset startTime by 1 frame, set blending mode, set opacity
         var theNewLayer = theLayer.duplicate();      
         theNewLayer.startTime = theNewLayer.startTime - activeItem.frameDuration;
         theNewLayer.blendingMode = BlendingMode.MULTIPLY;
         theNewLayer.opacity.setValue(50);
         
         // repeat for second duplicate
         theNewLayer = theLayer.duplicate();         
         theNewLayer.startTime = theNewLayer.startTime + activeItem.frameDuration;
         theNewLayer.blendingMode = BlendingMode.MULTIPLY;
         theNewLayer.opacity.setValue(50);      
      }
   }
}
 
SFR75
Topic Author
Posts: 17
Joined: Tue Apr 03, 2007 10:49 am

Mon Dec 17, 2007 5:11 am

Wow! :shock: Thanks!
 
Space Pumpkin
Posts: 1
Joined: Thu May 02, 2013 2:31 am

Re: Onion skin

Mon Jun 24, 2013 3:57 am

Hi
Question( couple of years later) where would this code go.
In the Position expression?

Cheers
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Onion skin

Mon Jun 24, 2013 1:47 pm

It's a script, not an expression. So you'd save it as a txt file with a .jsx extension then run it using File > Scripts > Run Script File, or save it into the After Effects / Scripts folder, restart AE and run it by selecting it from the File > Scripts menu.

Paul
 
User avatar
jwiley20
Posts: 1
Joined: Sat Nov 03, 2007 8:20 am
Location: Cleveland
Contact:

Re: Onion skin

Thu Apr 03, 2014 10:23 am

That script is nice n'all but it doesn't really perform the function of onion skinning as needed for animation. I have a somewhat simple work around for onion skinning in After Effects. It involves duplicating the animated layer and then nesting a comp of itself within the original comp. You must pick-whip expressions between the attributes on the duped layer in the nested comp to the original attributes on the animating layer. You then apply the echo effect to that nested comp and adjust to preference.

Well an image is worth a thousand words as they say:
http://snk.to/f-cd1nlhpz

Here's the AE file as well (It's CC):
http://snk.to/f-ctjl43fn

This awesome script helps to automate the linking through expressions process:
http://aescripts.com/duplicate-with-connections/

Who is online

Users browsing this forum: No registered users and 2 guests