Copy link to clipboard
Copied
Hi there,
professional scripters might not think of this to be a problem, but I cannot solve it on my own after hours of trying.
I found a random script on www.motionscript.com (thank you so much Dan, for this great resource, you're awesome!).
The sample for "random motion - more chaotic" is exactly what I need, but for the scale property with same random values for xScale and yScale (so that the random scaling is proportionally). I cannot figure out how to do this. I know I need another variable, but I don't know where.
Actually, I want to have a matrix of dots, each scaling up and down again randomly and independently in size and timing...
This is what I got so far:
segMin = .3;
segMax = .7;
minValX = 100;
maxValX = 200;
minValY = minValX;
maxValY = maxValX;
minVal = [minValX, minValY];
maxVal = [maxValX, maxValY];
seedRandom (index, true);
segDur = random (segMin, segMax);
seed = Math.floor (time / segDur);
segStart = seed * segDur;
seedRandom (seed, true);
startVal = random (minVal, maxVal);
seedRandom (seed+1, true);
endVal = random (minVal, maxVal);
easeOut (time, segStart, segStart + segDur, startVal, endVal);
I'd appreciate someone's help without being to demanding 🙂
Thanks a lot for reading this.
Chris
Try it this way:
segMin = .3;
segMax = .7;
minVal = 100;
maxVal = 200;
seedRandom (index, true);
segDur = random (segMin, segMax);
seed = Math.floor (time / segDur);
segStart = seed * segDur;
seedRandom (seed, true);
startVal = random (minVal, maxVal);
seedRandom (seed+1, true);
endVal = random (minVal, maxVal);
easeOut (time, segStart, segStart + segDur, [startVal,startVal], [endVal,endVal]);
Dan
Copy link to clipboard
Copied
Try it this way:
segMin = .3;
segMax = .7;
minVal = 100;
maxVal = 200;
seedRandom (index, true);
segDur = random (segMin, segMax);
seed = Math.floor (time / segDur);
segStart = seed * segDur;
seedRandom (seed, true);
startVal = random (minVal, maxVal);
seedRandom (seed+1, true);
endVal = random (minVal, maxVal);
easeOut (time, segStart, segStart + segDur, [startVal,startVal], [endVal,endVal]);
Dan
Copy link to clipboard
Copied
Thank you very much, Dan!
Exactly what I wanted to achieve within hours of trial and error... I will analyze the difference in code... 🙂
Copy link to clipboard
Copied
THANKS dAN..
Copy link to clipboard
Copied
Hey Dan, would you help me, please. After a lot of trial and error trying by myself, I couldn't figure it out.
I would like an expression that sets a random scale (with equal values in xScale and yScale). And I would like to control the animation with keyframes. I would parent each layer to a Null to control it. But I want to randomize the scale of a bunch of circles with a random seed based on the layer index. Thanks!
Copy link to clipboard
Copied
I did it! I don't know if it is right, but is working
minVal = 50;
maxVal = 200;
seedRandom (index, true);
ds = random (minVal, maxVal);
value + [ds,ds];
Copy link to clipboard
Copied
I understand Dan's correction in the script, but I'd never figured that out on my own... As the variable for startVal and endVal just holds a one-dimensional value you have to evaluate this value in the form of a two-dimensional array... This script works at its best! Just copy and paste it to the scale property (or any other two-dimensional property, or adjust it for another dimension).
As I proceeded I tried to adjust the script so that an object scales up to a random Size (easeIn) then remains in that state for a chosen (or randomly generated) amount of time (might even be 0) and then scales down with the same speed (easeOut) to its original size. The time of each animation should depend on the "scale factor". The more an object is scaled up, the longer the animation must be to make all these dots in the grid appear scaling with the same speed.
Therefore I found another script on Dan's website that comes close to what I belong for, but it seems I still didn't get the clue, how scripting in AE really works. The following script scales an object from a starting value to an ending value, holds this for a while, but then suddenly resets the object to its original size without animation. You might laugh but I nearly tried a whole day to achieve this animation without significant proceeding.
scaleTime = 0.5;
holdTime = 1;totalTime = scaleTime + holdTime;
segTime = time % totalTime;
startVal = 100;
endVal = 200;
if (segTime % time == 0) {
easeIn (segTime, 0, scaleTime, value, [endVal,endVal]);
} else {
easeOut (segTime, 0, scaleTime, value, [startVal,startVal]);
}
Can anyone explain, why the following script just resets the scale property after the end of totalTime without any animation? Any idea how to do it "the expert's way"?
Thanks for anything that might get me on track 🙂
Chriz
Copy link to clipboard
Copied
I'm not sure what you're going for, but play around with this:
scaleTime = 0.5;
holdTime = 1;
totalTime = scaleTime + holdTime + scaleTime;
segTime = time % totalTime;
startVal = 100;
endVal = 200;
if (segTime < scaleTime){
easeIn (segTime, 0, scaleTime, [startVal,startVal], [endVal,endVal]);
}else{
easeOut (segTime, scaleTime+holdTime, totalTime, [endVal,endVal], [startVal,startVal]);
}
Dan
Copy link to clipboard
Copied
Thanks a lot again, Dan! I'll try putting things together and I'll post my final script here if working as intended...
So stay tuned 🙂