Activity › Forums › Adobe After Effects › expressions help
-
expressions help
Posted by Josef Brett on August 31, 2006 at 9:19 amI’ve just been looking through an old tutorial by Dan Ebberts entitled ‘How to build the worlds greatest Cameraman’ with this link
Part of the tutorial has a section called ‘Angle and Color Control’. I very much like this effect, but was wondering if there was any possible way to make the circle close again, once it has opened. What I mean to explain further is that when all of the Clef’s appear, is there anyway to make them all dissapear again, one by one from the original start position. So it looks like a fan opening, then closing again.
Sorry thats a bit confusing, but I’m finding it hard to explain. Any help would be appriciated.
Joe
Josef Brett replied 19 years, 8 months ago 4 Members · 8 Replies -
8 Replies
-
Mylenium
August 31, 2006 at 2:07 pmI don’t quite get what you are trying to say, but you are free to counter-animate everything by reversing the timing of the expression controls. AE does not care in which order you do stuff, it only looks for values.
Mylenium
[Pour Myl
-
Josef Brett
August 31, 2006 at 2:45 pmsorry, what I am trying to do is have an image to start with, then for repetitions of that image to fan out in a circle in a clockwise motion. Then, when that circle is complete, I want the ‘fan’ to ‘close’ in a clockwise motion also. So the repetitions begin to disappear from the original start point. Hope that makes more sense. A way to describe it would be to say that it looks like it’s chasing itself.
-
Mylenium
August 31, 2006 at 4:56 pmYeah. You’d only need to explicitely define a start and end element and then calculate the angles based on that – fan out use the start element, fan in use the end element. I don’t have the time to write it all up, but it really isn’t that difficult.
Mylenium
[Pour Myl
-
Mike Clasby
August 31, 2006 at 5:43 pmAs a hack you can get the expression to do what you want with keyframes on the Angle control. From Dan’s comp it looks like keyframes for 0 then 18 degrees rotate the fan from closed to open. If you make that 18 degree keyframe a Hold keyframe (right click) then it will be locked open, then down the line, when you want to close the fan as you described, set a keyframe at -18 degrees, then add another keyframe for 0 down the line and it will close.
Only trouble is the -18 does a little flip thingie on the layers, but since they’re copies of the same layer and the closing movement is starting, it doesn’t look bad (to me).
You need another expression to do it the right way, maybe Dan, but I think it would be way more complex to make that top layer move first.
-
Dan Ebberts
August 31, 2006 at 6:03 pmTry this one:
rate = 360; //degrees per second
if (thisComp.numLayers > 1){
stopAngle = 360/(thisComp.numLayers – 1);
myAngle = (index – 1)*stopAngle;
}else{
stopAngle = 0;
myAngle = 0;
}
currAngle = time*rate;
if (currAngle > 360){
linear(currAngle – 360,myAngle,360,myAngle,360)
}else{
linear(currAngle,0,myAngle,0,myAngle);
}Dan
-
Mike Clasby
August 31, 2006 at 8:57 pmI like that expression, Dan, but I was working (hacking) your original expression to add a checkbox with an “if/else” (my first “if/else”, yikes) and it seems to work once I solved (I think) a layer order problem. So I gotta post this.
Ok, this fixes the little flip thingie and is more of a “standard” setup. They’ll be a checkbox for clockwise or counterclockwise, and another slider for the number of repetitions (this solves the flip thingie, a layer order problem when we go counterclockwise).
Dan’s original expression was:
index*this_comp.layer(“Null 1”).effect(“Angle Control”).param(“Angle”)
First add a checkbox to the null (Effect>ExpressionControls>Checkbox Control). This will tell it to fan out clockwise or counterclockwise.
Add another slider, name it “number of repetition layers”, this is to reverse the order of the layers so when we go counterclockwise you don’t get that flip (it’s a layer order thing).Here’s the expression:
n = thisComp.layer(“Null 1”).effect(“number of repetition layers”)(“Slider”) // number of repetition layers
clockwise = index*this_comp.layer(“Null 1”).effect(“Angle Control”).param(“Angle”)
counterclockwise = – (n – index)*thisComp.layer(“Null 1”).effect(“Angle Control”)(“Angle”)if (this_comp.layer(“Null 1”).effect(“Checkbox Control”).param(“Checkbox”) > 0){
clockwise
}else{
counterclockwise
}Line 1 defining “clockwise” as meaning Dan’s original expression.
Line 2 is counterclockwise = subtracting (-1) Dan’s expression but with the layer order reversed (at least I think that’s what it’s doing, n – index, for “n” number of repetition layers).the “if” of line 6 just says if the checkbox is checked rotate “clockwise”
else (meaning checkbox not checked)
rotate counterclockwise.So, Check the Checkbox and click the stopwatch, setting a keyframe for checkbox “on”
On the Slider Control set keyframes for 0, then down the line “18” to open the fan. If you want to keep the fan open for an amount of time, go down and set another keyframe for 18. When you want it to fold up, clockwise, uncheck the checkbox at that last 18 (it sets a keyframe) and then set the Slider to 0 down the line.So you can open or close the fan in either direction depending on the checkbox and Angle slider settings.
If the slider for the “number of repetition layers” doesn’t match the actual number of repetitions, if it greater than the number of reputations you get a weird little sliding fold up of the fan, kinda cool looking really.
The checkbox can be a little confusing (for me especially just set an initial keyframe (stopwatch, then when you check or uncheck the box it sets another keyframe for you.
The “if/else” conditional was from Dan’s page:
https://www.motionscript.com/mastering-expressions/language-beginning-4.html
-
Josef Brett
September 1, 2006 at 8:40 amThank you all for the help. Thats brilliant and now my head is awash with maths! I’ll go try and stick all those in the correct places!!
Reply to this Discussion! Login or Sign Up