-
Change object size at certain time and make it stick
Hi there,
I’m making a lava lamp emulation, and since the end result should be about an hour long, it’s too time consuming to keyframe everything. Therefore, I decided to give expressions a go. Through a lot of studying (thanks, Dan!) and trial and error, I managed to come up with something that works okay.
What I now want to do is to be able to change the size of the lava blobs, to a random size, whenever the blobs hit the bottom (posDown in the code below). And then KEEP that same size until the next time it reaches posDown. Alternatively, give a random x position when the blobs hit the bottom.
Is that even possible? I played around with using random() on the size property, but it’s changing the size at random at every frame – and if I use seedRandom, it always changes to the same size at every loop. Moreover, I can’t get it to stay at that size.
Any help is much appreciated.
Thanks in advance.
POSITION Y EXPRESSION
---------------------------------
seedRandom(index,true);
blobSize = content("Ellipse 1").content("Ellipse Path 1").size[0];
holdDur = random(2,8);
moveDur = linear(blobSize,100,800,10,40);
posUp = -blobSize*0.5;
posDown = thisComp.height+blobSize*0.5;t1 = holdDur;
t2 = t1+moveDur;
t3 = t2+holdDur;
t4 = t3+moveDur;t = time % t4;
if (t < t1){
posDown
}else if (t < t2){
easeOut(t,t1,t2,posDown,posUp)
}else if (t < t3){
posUp
}else{
ease(t,t3,t4,posUp,posDown)
}POSITION X POSITION
------------------------------
seedRandom(index,true);
xPosRand = random(thisComp.width);
xPosWig = wiggle(0.2,200);
xPos = xPosRand + xPosWig - thisComp.width*0.5;[xPos]