Copy link to clipboard
Copied
I came across an animation that depicts a series of diagonal lines unfolding like a fan. The artwork is simple enough but I wasn't sure how to build this in after effects and I wondered if there might be an expression to create this type of effect. I appreciate any suggestions. Here is the link below to the animation.
Ira
http://www.mediafire.com/file/36y0yi88mnh42vk/unfold%20effect.mov
This is just an exercise in basic math. If you put a slider control on a null layer and then use the index (layer number) as a multiplier you can fan out the layers by simply adjusting the slider. Throw in an if else statement to count the number of layers and stop the increase in the angle when the circle is filled and you've got the solution.
If you put the null layer with the slider control at the bottom of the layer stack this expression should work for you:
ctrl = thisComp.layer("Null 1").ef
...Copy link to clipboard
Copied
This is just an exercise in basic math. If you put a slider control on a null layer and then use the index (layer number) as a multiplier you can fan out the layers by simply adjusting the slider. Throw in an if else statement to count the number of layers and stop the increase in the angle when the circle is filled and you've got the solution.
If you put the null layer with the slider control at the bottom of the layer stack this expression should work for you:
ctrl = thisComp.layer("Null 1").effect("Slider Control")("Slider");
numSeg = thisComp.layer("Null 1").index - 1;
val = 360 / numSeg
if (ctrl < numSeg) {
mult = (ctrl * (index -1))*(val)/numSeg
}
else if (ctrl >= numSeg) {
mult = (index * val)
}
value + mult
ctrl is the slider control value
numSeg counts the number of line layers in the comp by subtracting 1 from the layer number of the null layer (the null must be at the bottom)
val calculates the angle between layers when evenly distributed in a circle
The if statement says if the ctrl (slider value) is less than the number of segments then multiply the slider value times the layer number less one (so the top layer doesn't rotate) and then divide that value by the number of segments.
The else if statement says if the slider value is greater than or equal to the number of layers rotate the layer by the layer number times 360 divided by the number of layers. This evenly distributes the layers around the circle.
The value + mult at the end just says take the initial value of rotation and add the new value of the rotation to this layer. This works if you set the rotation angle of the starting layer first. If you want control after duplicating the layers then replace the "value" operator with an angle expression controller.
All you have to do to make this work is to put the anchor point on one end of a line segment, add an expression slider to a null, put the null at the bottom, then add the expression to the line layer and duplicate it as many times as you want.
Copy link to clipboard
Copied
This is fantastic Rick, thank you very much for your wonderful help and explanation of the process. This work perfectly!
Best Regards
Ira
Copy link to clipboard
Copied
Hello,
Oh, it's not working for me! I need this expression! Can you post an ae file? I don't know where my problem come from :
1. Create a null, then a slider control on to it
2. Create a shape, copy and paste the expresssion into the rotation parameter
3. Error occured (i'm french so i can't tell you the trnaslation into english).
What's my problem (sorry for my english!)
Copy link to clipboard
Copied
Here is a link for the AE file. I'm not an expression expert, but Rick Gerard who posted the solution would be good to ask questions.