seblavoie
1/31/2018 - 5:05 PM

After Effects nulls character rig

After Effects nulls character rig

app.beginUndoGroup("Add character")

var activeComp = app.project.activeItem;
var wiggleExpression = 'seedRandom(index);wiggle(thisComp.layer("Controller").effect("Freq")("Slider"), thisComp.layer("Controller").effect("Amp")("Slider"))'

// Adding controller layer
var controllerLayer = activeComp.layers.addNull(activeComp.duration);
controllerLayer.name = "Controller";
effect = controllerLayer.Effects.addProperty("Slider Control");
effect.name = "Freq"
effect.property("Slider").setValue(1)
effect = controllerLayer.Effects.addProperty("Slider Control");
effect.name = "Amp"
effect.property("Slider").setValue(8)
effect = controllerLayer.Effects.addProperty("Slider Control");
effect.name = "Wiggle"
effect.property("Slider").expression = wiggleExpression

// Adding character layer
var characterLayer = activeComp.layers.addNull(activeComp.duration);
characterLayer.name = "- character";
characterLayer.moveAfter(controllerLayer)

// Adding body layer
var bodyLayer = activeComp.layers.addNull(activeComp.duration);
bodyLayer.name = "-- body";
bodyLayer.parent = characterLayer
bodyLayer.moveAfter(characterLayer)
bodyLayer.transform.rotation.expression = wiggleExpression

// Adding head layer
var headLayer = activeComp.layers.addNull(activeComp.duration);
headLayer.name = "-- head";
headLayer.parent = bodyLayer
headLayer.moveAfter(bodyLayer)
headLayer.transform.rotation.expression = wiggleExpression



app.endUndoGroup()