Copy link to clipboard
Copied
Hi there,
I have multiple objects (side by side) which I would like to sway on the z-axis as if the wind is blowing them. I already have their anchor points at the top of each object. I have a few issues:
Any thoughts?
Thank you very much!
-Stephen
Copy link to clipboard
Copied
Set different random seeds for each layer. You could use the layer index for that. Set up a value at time expression and use the layer index to add variations of timing to each layer. Use the slider to control the amount of sway either as a percentage or as a max value for a min max expression. Are you experienced enough with expressions to try and write it or was the preceding just so much nonsense to you?
Copy link to clipboard
Copied
Thank you Rick,
Unfortunately I'm not too experienced with writing expressions (especially ones I've never used before) but I am able to read expressions somewhat. And as long as I know the term to search for "random seeds?" I should be able to google some help. Do you have ideas off the top of your head for the sway expression?
Here's is a hodgepodge expression which I don't recall if I pieced it together or found it complete (this was last month that I worked on this project). I thought i could customize it to ramp the sway on and off or even use a decay (is that the right term) expression to have it slow down over time (say, after 1 second it slows to a stop):
swingMaxDistance = thisComp.layer("controls").effect("sway1")("Slider");
swingSpeed = thisComp.layer("controls").effect("sway1")("Slider")*3;
easeTimeSpan = 6;
easeOutSpeed =thisComp.layer("controls").effect("SwayEaseOut")("Slider");
easeOutVal = easeOut(time*easeOutSpeed, 0, easeTimeSpan, swingMaxDistance, 0);
Math.sin(time * swingSpeed) * easeOutVal + transform.rotation;
I have a feeling this expression is far more complex than needed which is why I assume I had pieced it together during my run of all-nighters working on this project. Boy did I re-learn a lot about math which I never thought would be useful in the "real world!" In the above expression I thought I could link the easeOutSpeed to a slider which I could adjust but it's not working...
Thank you very much for your help! I'll begin looking into the random seeds idea to see just how that works.
Any thoughts are appreciated!
-Stephen
Copy link to clipboard
Copied
Well, I'm getting closer but I'm not there yet.
I found out how to use this expression which seems to do what I want but only for a single object sway. If I could randomize this and put it on all of the items it would be pretty close. Here's the expression:
Math.sin(time*2)*1;
This has two problems. First it appears to start swaying at the begining of the comp instead of the comp starting with the object already swaying. I might be wrong on this.
The other problem I already mentioned. I don't know how to randomize this so each additional object has a random sway. I at least found out how to attach the stay to a slider:
Math.sin(time*2)*thisComp.layer("new slider control").effect("SwayAmmount")("Slider");
I am able to set the slider at 1 and then to stop it I set it to 0. I don't think this has a real ease or inertia, but it's ok I guess.
But again, no random options. I've searched high and low to understand the random function. I found: "random()" but I need it to freeze at a random number. I found "seedRandom(x,true)" but all directions I can find for that talk only about possition in the comp. I've given up trying to translate this from position.
Here's the closest I've come, but honestly I'm not even sure that it's a real function...
seedRandom(3,true);
RanNum = random(-2,4)
Math.sin(time*(RanNum))*thisComp.layer("new slider control").effect("SwayAmmount")("Slider");
This again links to the slider. It DOES randomize somewhat and is better than nothing. But surely there is a "correct" way which I am completely overlooking. Using this method all layers sway left to right (fairly similarlily). I would love to have some begin right to left, random...
Any thoughts?
Thanks!
-Stephen
Find more inspiration, events, and resources on the new Adobe Community
Explore Now