Activity › Forums › Adobe After Effects Expressions › Scale expression (randomized) for 100+ layers over set period of time
-
Scale expression (randomized) for 100+ layers over set period of time
Posted by Al Mach on May 25, 2017 at 9:47 pmI’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!
Cristina Gaytan replied 8 years, 9 months ago 5 Members · 10 Replies -
10 Replies
-
Dan Ebberts
May 25, 2017 at 10:02 pmSomething 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
-
Al Mach
June 1, 2017 at 6:21 pmFollowing 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?
-
Dax Castro
June 1, 2017 at 6:28 pmYou 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: www.animoplex.com
// Original Version: https://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: https://www.youtube.com/watch?v=653lxeVIyoo// 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 < 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
Some contents or functionalities here are not available due to your cookie preferences!This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.
-
Tim Wilson
June 1, 2017 at 7:47 pmGreat 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!
-
Al Mach
June 2, 2017 at 4:46 pmThanks 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.
-
Dan Ebberts
June 2, 2017 at 5:37 pmIf 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
-
Al Mach
June 2, 2017 at 5:59 pmIt 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?
-
Dax Castro
June 2, 2017 at 9:46 pmIt basically calculates the velocity (time spent going from one size to the other) to determine the bounce amount.
Dax
-
Cristina Gaytan
July 25, 2017 at 11:29 amHi! This expression worked for me, but I don’t manage to add a bounce effect to it. I don’t care if the bounce value is 130% or whatever, just need to add bounce effect to the random scale expression without adding keyframes… is this possible?? Thanks!
seedRandom(index,true);
tStart = random(1);
dur = random(framesToTime(10),framesToTime(20));
ease(time,inPoint+tStart,inPoint+tStart+dur,[0,0],[100,100]);
Reply to this Discussion! Login or Sign Up
