Onion skin

What type of scripts do you need?

Moderator: byronnash

Post Reply
SFR75
Posts: 17
Joined: April 3rd, 2007, 10:49 am

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: June 5th, 2004, 7:59 am
Location: London, UK

Give this a try:

Code: Select all

{
	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
Posts: 17
Joined: April 3rd, 2007, 10:49 am

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

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

Cheers
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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: November 3rd, 2007, 8:20 am
Location: Cleveland
Contact:

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/
Post Reply