Though I've been using after effects for 5 years + and also been using expressions for just as long... I never delivered into scripting until recently, and this is where it's thrown me.
I've been trying to create a script to simply reproduce what I would normally take 10 minutes to do, to a single click. But, so far I'm stuck.
here's what I'm trying to do via a script on say 3 layers but could be more:
step 1: on the active comp
step 2: with selected layers ( first layer to the last layer )
step 3: create a null at the anchor point of the first layer selected called "Driver"
step 4: add 4 slider controls to the first selected layer ( layer 1 ): "Slider 1" "Slider 2" "Slider 3" "slider 4"
Step 5: Add an expression control to layer 1
step 6: chain parent the selected layers together ignoring the null object
Driver - no parent
Layer 1 - no parent
Layer 2 - parented to layer 1
Layer 3 - parented to layer 2
step 7: Add an expression to layer 1's rotation parameter
Slider 1 = this comps null object slider 1
Slider 2 = this comps null object slider 2
Slider 3 = this comps null object slider 3
Slider 4 = this comps null object slider 4
- rest of expression here -
step 8: add an expression to layer 2++ until the end of selected items
- expression here -