FORUMS: list search recent posts

A better way to write this?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eric Sanderson
A better way to write this?
on Jul 25, 2012 at 4:54:44 pm

I like to think i know just enough about expressions to mess a lot of stuff up lol. The following "works", as in doesn't break but it makes AE run unusably slow. Its pretty straight forward, i have a grid of tiles animating into the screen, via valueAtTime referencing the null. I often do this and set up a sort of Random rig as you see, creating controls for the seedRandom and random amount on the valueAtTime. But what you see here is my first attempt at being able to activate that Random with a checkbox, which is where things really slow down. I figured maybe instead of randomizing the actual time referenced, it would be faster to randomize the index its referencing, up to numLayers, i dunno, thats why i turn to the experts. Hoping i can get this running faster and learn a thing or 2 in the process. Thanks so much.




anim01 = thisComp.layer(index-1).transform.zPosition.valueAtTime(time-thisComp.layer("controller").effect("tDelay")("Slider"));

seedRandom(index+thisComp.layer("controller").effect("Random Seed")("Slider"),true);

r=random(0,thisComp.layer("controller").effect("Random Spread")("Slider"));

anim02 = thisComp.layer(index-1).transform.zPosition.valueAtTime(time-r);

check = thisComp.layer("controller").effect("Randomizer")("Checkbox");

if(check==true){anim02
}else{
anim01
}


Return to posts index

Dan Ebberts
Re: A better way to write this?
on Jul 25, 2012 at 5:20:14 pm

I don't know how much this would speed it up, and I haven't tested this code, but I'd set it up like this:


ctl = thisComp.layer("controller");
check = ctl.effect("Randomizer")("Checkbox");
if (check)
delay = random(0,ctl.effect("Random Spread")("Slider"))
else
delay = ctl.effect("tDelay")("Slider"));

thisComp.layer(index-1).transform.zPosition.valueAtTime(time-delay);


Dan



Return to posts index

Eric Sanderson
Re: A better way to write this?
on Jul 25, 2012 at 6:47:31 pm

Well it made the comp responsive again so thats a win. For the "(check)", does it just default to checking if thats true or not if you don't actually write out a condition, defaulting to a boolean i guess it would be right?


Return to posts index


Dan Ebberts
Re: A better way to write this?
on Jul 25, 2012 at 6:55:06 pm

That's correct. Since the value of the checkbox will be 1 or 0, that will be interpreted as true or false.

Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]