ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Scale expression (randomized) for 100+ layers over set period of time

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Al Mach
Scale expression (randomized) for 100+ layers over set period of time
on May 25, 2017 at 9:47:02 pm

I'm trying to randomize a short scale up from 0-100% on many different layers. Basically I just want around 100 different circles (vector layers imported from Illustrator) to randomly (and elegantly) scale from 0-100% in a 1 second time-frame (the actual scale time would be like 10-20 frames). I've tried searching for the answer but I can't seem to find how to do this specifically. I just want a simple, eased scale-up with some random offsets on the different layers.

Any help would be much appreciated!


Return to posts index

Dan Ebberts
Re: Scale expression (randomized) for 100+ layers over set period of time
on May 25, 2017 at 10:02:16 pm

Something like this maybe:

seedRandom(index,true);
tStart = random(1);
dur = random(framesToTime(10),framesToTime(20));
ease(time,inPoint+tStart,inPoint+tStart+dur,[0,0],[100,100]);


Dan



Return to posts index

Al Mach
Re: Scale expression (randomized) for 100+ layers over set period of time
on May 25, 2017 at 10:30:58 pm

That works, thanks so much!


Return to posts index


Al Mach
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 1, 2017 at 6:21:14 pm

Following up on this, is there a modification I can make to this expression to have the layers scale up (say to 130%) from 100%, then scale back down to 100%? Kind of like a pulse?


Return to posts index

Dax Castro
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 1, 2017 at 6:28:37 pm

You might try this. It is for inertial energy "bounce" based on velocity. I use it for a lot of my stuff when an object grows in a scene.

// Inertial Bounce - Created by Animoplex: http://www.animoplex.com
// Original Version: http://www.graymachine.com/top-5-effects-expressions/
// Modified expression for a smoother bounce effect and easier editing. Use this on any property with two keyframes to get a nice bounce effect that is based on velocity of the value change. Perfect for a scale from 0 to 100 or a speedy rotation that needs some extra life. Adjust amp, freq and decay values to tweak the effect. Amp is intensity, freq is bounces per second, and decay is the speed of decay, slow to fast.
// Full Tutorial:






// Variation A

amp = 5.0; freq = 2.0; decay = 4.0;

n = 0;
if (numKeys > 0) {
n = nearestKey(time).index;
if (key(n).time > time) { n--; }
}
if (n == 0) { t = 0; }
else { t = time - key(n).time; }
if (n > 0 && t &lt; 1) {
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*(amp/100)*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}
else { value; }


Dax


Return to posts index

Tim Wilson
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 1, 2017 at 7:47:26 pm

Great post, Dax!

Very interesting to me that when the Harper points out that his is a variation of an effect that he got from someone else, he gives its origins: "I got it from Harry Frank...who got it from mograph.net, who got it from Dan Ebberts."

So thanks, too, to Dan!


Return to posts index


Al Mach
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 2, 2017 at 4:46:48 pm

Thanks for this. Unfortunately I'm getting an error. "Expression Disabled. Error at line 12 in property 'Scale' of layer1..."



Not sure why, I pretty much followed the tutorial exactly. Also, I need to apply this to about 50 layers and randomize the scaling, so not sure this would be as efficient. Appreciate your help.


Return to posts index

Dan Ebberts
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 2, 2017 at 5:37:07 pm

If you preview your post when posting code, any < symbols get mangled, which looks like what may have happend. Just change the (ampersand)lt; back to < and give it a try.

Dan



Return to posts index

Al Mach
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 2, 2017 at 5:59:37 pm

It worked when I changed the code from "if (n > 0 && t < 1)" to "if (n > 0 && t < 1)". Replacing just the ampersand before the "lt" still was erroring out.

This is expression is great to go between two values, but I really need to start the scale from 100%, going up to about 130%, then back to 100%, like a pulse. Is that possible with a tweak for this code? Also, is it possible to apply this expression to 50 other layers so it's randomized?


Return to posts index


Dax Castro
Re: Scale expression (randomized) for 100+ layers over set period of time
on Jun 2, 2017 at 9:46:00 pm

It basically calculates the velocity (time spent going from one size to the other) to determine the bounce amount.

Dax


Return to posts index

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