christianchoice 0 Report post Posted October 15, 2008 Is there a way to grab the value of a variable in another layer? layer1{n=180} layer2{n=thisComp.layer1.variable('n') + 5} i know this isn't the correct syntax, but that's what i envision in my mind. any help would be great . thanks. Quote Share this post Link to post Share on other sites
jablinko 0 Report post Posted October 15, 2008 i dont think AE allows global variables, you could use an expression controller slider etc as a holder for that value Quote Share this post Link to post Share on other sites
christianchoice 0 Report post Posted October 15, 2008 i dont think AE allows global variables, you could use an expression controller slider etc as a holder for that value hmmm... well the thing is, it's going to be a cascading effect involving over 100 layers. I want the layer below to read a specific value from the layer above... it's not a huge deal, i'll just have to manually encode the specific values.... Quote Share this post Link to post Share on other sites
jablinko 0 Report post Posted October 15, 2008 hmmm... well the thing is, it's going to be a cascading effect involving over 100 layers. I want the layer below to read a specific value from the layer above... it's not a huge deal, i'll just have to manually encode the specific values.... go on creative cow, dan ebberts is the man with helping people write custom expressions Quote Share this post Link to post Share on other sites
Adolfo Rozenfeld 0 Report post Posted October 15, 2008 go on creative cow, dan ebberts is the man with helping people write custom expressions You don't need global variables (which AE doesn't allow for a few reasons) for this. You can sample from the layer above by using something like: layer(index-1).propertyName, etc. Quote Share this post Link to post Share on other sites
substandard 0 Report post Posted October 15, 2008 (edited) Your probably going to be surprised that your render time increases exponentially with a cascading expression. I don't know exactly what kind of effect you're going for, but Dan Ebberts tutorial on motion trails might help you figure out an alternative. Edited October 15, 2008 by substandard Quote Share this post Link to post Share on other sites
graymachine 0 Report post Posted October 15, 2008 While on the topic, there's a little known workaround for global variables, which is "#include" On a Mac, you can use: #include '/expressions/source.txt' For a file located in a folder called "expressions" at the root of your drive, in a text file called "source". On Windows, you'll need something like this: #include 'file:///c:\\expressions\source.txt' In that file, the syntax will be treated just like an expression. So, you can put something like: gVar = 10; And then use that include statement in each layer, and then 'gVar' will kinda sorta be a global variable that you can change in one place. For this particular solution, I can't really tell if this will be useful or not. Perhaps you could define a slew of variables in one place to save time? Just a guess. Quote Share this post Link to post Share on other sites
christianchoice 0 Report post Posted October 15, 2008 I'm animating a magazine with flipping pages. I'm trying to control the page turns with one controller. The theory is to wait for the other page to complete it's turning before this one can turn. Thus this angle limits. These will change as the revolutions go up in the global controller. If someone has another idea, that would be great . I will try that #include statement. I was wondering if AE did that. Thanks graymachine. //Sets the layers above & below for future referencing. layerAbove = thisComp.layer(index-1); layerBelow = thisComp.layer(index+1); if((layerAbove.transform.yRotation==(0||180))||layerBelow.transform.yRotation==0) { if(thisComp.layer("Null 1").effect("Angle Control")("Angle")<=360) { 0; } else if(thisComp.layer("Null 1").effect("Angle Control")("Angle")>=540) { 180; } else { thisComp.layer("Null 1").effect("Angle Control")("Angle"); } } else {transform.yRotation=0;} Quote Share this post Link to post Share on other sites
Mylenium 0 Report post Posted October 15, 2008 I'm animating a magazine with flipping pages. *snippeted* Wrong approach and methodology. You don't need any global variables at all, so get this notion out of your head. You also don't need any conditionals. Just animate a prototype layer, then use valueAtTime() to trigger the other layers' properties. For variation, you could even add a multiplier to the time. Having a complete cycle is made sure by setting proper start and end keyframes to begin with... Mylenium Quote Share this post Link to post Share on other sites
christianchoice 0 Report post Posted October 15, 2008 (edited) Wrong approach and methodology. You don't need any global variables at all, so get this notion out of your head. You also don't need any conditionals. Just animate a prototype layer, then use valueAtTime() to trigger the other layers' properties. For variation, you could even add a multiplier to the time. Having a complete cycle is made sure by setting proper start and end keyframes to begin with... Mylenium so animate one layer. then set the other layers rotation to valueaAtTime()? but i need to be able to control the speed of the flips. I need to be able to pause on a page, then go to the next one, etc. I used another method that doesn't need a global variable... It works, but if you think your method would still be more efficient, could you please explain a bit more... Edited October 15, 2008 by christianchoice Quote Share this post Link to post Share on other sites
Mylenium 0 Report post Posted October 15, 2008 but i need to be able to control the speed of the flips. I need to be able to pause on a page, then go to the next one, etc. I didn't say anything else. ;-) Consider: What's stopping you from massaging time as you see fit? Nothing! Just like you would slow down the notorious wiggle() by rigging it with sliders, you could add an extra multiplier for time... On the abstract level you'd have to do the following: - determine the current "segment" by dividing the overall time based on the prototype animation duration (Math.floor(time/(keyB-keyA)) - match the result to the index to determine animation order - compare the time within a segment to the reference animation and use it to drive the animation (valueAtTime(time - index*(keyB-keyA)) - add a multiplier to the time to control flipping speed based on a expression slider (valueAtTime(time *speedSlider - index*(keyB-keyA)) From there you can refine it infinitely. The slider can either be "global" (covering the full time of all layers) or "local" (for the current segment). The first is simpler of course, the second provides finer control. For the latter you would use a modulus division (%) to reset the slider as the animation changes segments. The downside is that time() can never be zero, so it will technically never fully freeze. This could be circumvented by nesting the comp and using time-remapping on the uniformly animated expression stuff. You could also use the layer's inPoint() and work with the Sequence Layers keyframe assistant to determine animation order. Quite a few options... Mylenium Quote Share this post Link to post Share on other sites
christianchoice 0 Report post Posted October 15, 2008 i read what you're saying, but i'm just not understanding . me = newb. Quote Share this post Link to post Share on other sites
christianchoice 0 Report post Posted October 16, 2008 thanks for that valueAtTime(). Most appreciated. Quote Share this post Link to post Share on other sites