Re: Error with gravity expression by Dan Ebberts on May 11, 2008 at 6:23:34 pm
My guess is that you've got your graphic positioned below the "floor" which you've got set to 400. If so, try moving the graphic to a location where y is less than 400.
Re: Error with gravity expression by David Rodriguez on May 11, 2008 at 6:39:00 pm
You were correct Sir! I changed my floor to 1050 and the error has gone away. Now I need to figure out (have someone tell me) why the balls all bounce to the right and off screen.
My animation is this. I have a gel capsule graphic that breaks open to drop sixty tiny capsules onto the floor, they then bounce up and down a few times then form a heart wave graphic.
I am trying to get the bounce to look natural. The tiny capsules are all released from a central point in the screen and I need them to bounce and spread out over the width of the screen. Currently they all bounce to the right and off screen.
Perhaps I need a different expression or some randomness?
Re: Error with gravity expression by Dan Ebberts on May 11, 2008 at 11:08:41 pm
You control the horizontal direction and speed with the Vx0 variable. If you make that negative, it will move to the left. If you make it smaller, it will move slower. To get it to stop though, I think you'd have to add some friction so that it slows down on each bounce. Probably not too tough. I don't have time to work it out right now, but I'll take a look at it when I get some time (unless somebody else wants to jump in).
Re: Error with gravity expression by Darby Edelen on May 12, 2008 at 12:10:54 am
Also, I thought I'd take this space to mention that I wrote a little expression that will take keyframed values and add an exponential decay to the end of the keyframes... This is a derivative of something Dan did on his site, so credit is due, as usual, mostly to Dan =)
n = value.length;
if(numKeys > 1){
firstKey = key(1).time;
lastKey = key(numKeys).time;
v = velocityAtTime(lastKey - thisComp.frameDuration);
a = 20;
decay = 2;
f = 1/a;
t = Math.max(time - lastKey, 0);
x = a * Math.sin(v[0] * t * f) / Math.exp(decay * t);
y = a * Math.sin(v[1] * t * f) / Math.exp(decay * t);
z = a * Math.sin(v[2] * t * f) / Math.exp(decay * t);
value + [x,y,z];
}
else value;
This doesn't work for something bouncing off a hard surface like a floor, but it works well to simulate springy motions. In the above you may want your own values for 'a' and 'decay.' The above is for a 3 dimensional vector (such as 3D position or 3D scale). For a scalar value (1 dimensional like rotation) you would use:
if(numKeys > 1){
firstKey = key(1).time;
lastKey = key(numKeys).time;
v = velocityAtTime(lastKey - thisComp.frameDuration);
a = 2;
decay = 2;
f = 1/a;
t = Math.max(time - lastKey, 0);
x = a * Math.sin(v * t * f) / Math.exp(decay * t);
value + x;
}
else value;
Darby Edelen Lead Designer Left Coast Digital Santa Cruz, CA
Re: Error with gravity expression by David Rodriguez on May 12, 2008 at 2:55:52 am
Now how do I turn it off? Is there an easy way to let me take control of the animation at a certain point then have the expression take over further down the line?
Re: Error with gravity expression by Darby Edelen on May 12, 2008 at 2:57:16 am
That's not built in to this version of the expression =( I'll keep working on it though, it's something I expect to use a lot, I really like the results I'm getting for my current project =)
Darby Edelen Lead Designer Left Coast Digital Santa Cruz, CA