Jump to content


Photo

5 expressions that will change your life


  • Please log in to reply
59 replies to this topic

#1 Beaver

Beaver

    Mograph Deity

  • Members
  • 1,115 posts
  • Gender:Male

Posted 17 October 2007 - 06:53 PM

These expressions save so much time, you might get home earlier tonight just by reading this post. If you've ever animated these sorts of things manually, you'll know what I mean. Most will need to be tweaked to your specific needs, but it's just a matter of playing with the numbers a little, and understanding how they'll change your animation. Here's the goods:

Jumpy Wiggle 1 makes wiggle skip and hold rather than move fluidly.
// Jumpy Wiggle 1 (moves at a random FPS)
v=wiggle(5,50);
if(v < 50)v=0;
if(v > 50)v=100;
v

Jumpy Wiggle 2 is similar to 1, but works at a defined FPS so your "jump" will happen at a regular pace.
// Jumpy Wiggle 2 (moves at a defined FPS)
fps=5; //frequency
amount=50;  //amplitude
wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);

Inertial Bounce is like making your moves "rubbery." Layers will overextend, then settle into place on position and rotation keyframes.
// Inertial Bounce (moves settle into place after bouncing around a little)
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){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
amp = .05;
freq = 4.0;
decay = 2.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

Sometimes you just want something to move constantly without keyframing it. Use throw.
// Throw (move at a constant speed without keyframes)
veloc = -10; //horizontal velocity (pixels per second)
x = position[0] + (time - inPoint) *veloc;
y = position[1];
[x,y]

Same as throw, but for rotation.
// Spin (rotate at a constant speed without keyframes)
veloc = 360; //rotational velocity (degrees per second)
r = rotation + (time - inPoint) *veloc;
[r]

A shoutout to the brilliant folks at aenhancers.com who provided in whole or in part the basis for all of these expressions.

#2 brandj

brandj

    MoGraph Megastar

  • Members
  • 376 posts

Posted 17 October 2007 - 07:49 PM

Nice!

Inertial Bounce is hot.
"If you want to build a ship, don't drum up people to collect wood and don't assign them tasks and work, but rather teach them to long for the endless immensity of the sea." - Antoine de Saint Exupéry

#3 Cutty Pastey

Cutty Pastey

    MoGraph Megastar

  • Members
  • 244 posts
  • Gender:Male
  • Location:PHOENIX, AZ

Posted 17 October 2007 - 07:58 PM

10 master class points to you! especially for the Inertial Bounce. you sexy bitch you
-justin! @flockofpixels

#4 C.Smith

C.Smith

    Sermonizes Mograph to the Masses

  • Members
  • 2,936 posts
  • Gender:Male
  • Location:Santa Monica
  • Interests:Keepin it real.

Posted 17 October 2007 - 08:25 PM

Awesome. Now I'm going to make Inertial Bounce and Jumpy Wiggle in coffee for C4D **wrings hands with evil intention**

Thanks, Beav!!
chris smith :: some of my work

#5 TyMotion

TyMotion

    MoGraph Regular

  • Members
  • 86 posts
  • Gender:Male
  • Location:Los Angeles

Posted 17 October 2007 - 08:26 PM

Very Nice! Thanks alot.

#6 ynaka

ynaka

    MoGraph Superstar

  • Members
  • 174 posts
  • Gender:Male
  • Location:10011

Posted 17 October 2007 - 08:46 PM

I ruv it! Inertial bounce is dope.

Posted Image

#7 kitkats

kitkats

    MoGraph Demi-god

  • Members
  • 647 posts
  • Gender:Male
  • Location:London

Posted 17 October 2007 - 10:50 PM

Cool. Jumpy wiggle 1 is more-or-less what I'm usually trying to end up with 80% of the time I use the Wiggler. Thanks.

#8 basilisk

basilisk

    Mograph Deity

  • Members
  • 1,067 posts
  • Location:Oxford UK

Posted 18 October 2007 - 11:00 AM

Fantastic - loving inertial bounce. Request that you repost in resources so it doesn't get buried...

#9 Boost

Boost

    Newbie

  • Members
  • 29 posts
  • Location:Belfast

Posted 18 October 2007 - 11:38 AM

thumbs up for the inertia bounce - priceless. cheers Beaver

#10 basilisk

basilisk

    Mograph Deity

  • Members
  • 1,067 posts
  • Location:Oxford UK

Posted 18 October 2007 - 11:57 AM

You're underselling inertial bounce - you can put it in your scale parameter for squash and stretch bounciness, I even tried it with CC Bend It, to create a bendy rubber stick (apply it to the bend parameter, obviously)
Perhaps it could be used with puppet pins to create secondary motion in cartoon animation (I haven't tried this yet)?

#11 zook

zook

    MoGraph Demi-god

  • Members
  • 405 posts

Posted 18 October 2007 - 12:40 PM

Brilliant.

Thanks again.

Edited by zook, 18 October 2007 - 12:40 PM.

Ars longa, vita brevis.

#12 microdot

microdot

    MoGraph Demi-god

  • Members
  • 483 posts
  • Gender:Male
  • Location:Brooklyn

Posted 18 October 2007 - 02:16 PM

nice.

On throw, I wonder how you'd make it loop across the screen on one axis (or both),
so that when the left most edge exited the frame, it would re-emerge on the right side, while still exiting on the left.
Kinda like an offset loop, but with expressions.


hmmmmm?

#13 graymachine

graymachine

    Red Giant Software

  • Members
  • 10,086 posts
  • Gender:Male
  • Location:Portland
  • Interests:0s, 1s, pixels and particles.

Posted 18 October 2007 - 02:49 PM

nice.
On throw, I wonder how you'd make it loop across the screen on one axis (or both),
so that when the left most edge exited the frame, it would re-emerge on the right side, while still exiting on the left.
Kinda like an offset loop, but with expressions.
hmmmmm?


You'd have to stick with offset. An expression can't make an object appear in two places at the same time.

But, if it can leave the screen, you could do this:

startPos = 250;
endPos = thisComp.width;
end = thisComp.duration;
x = linear(time, 0, end, -startPos, endPos);
[x, value[1]]

Made an edit.. "startPos" has to be a sort of fudge factor. If you are using AE text, expressions cannot retrieve the width of a text layer. But, if you're layer has a fixed with, then you can use:

startPos = thisLayer.width;
endPos = thisComp.width;
end = thisComp.duration;
x = linear(time, 0, end, -startPos, endPos);
[x, value[1]]

Edited by graymachine, 18 October 2007 - 02:57 PM.

Harry Frank // graymachine.com


#14 microdot

microdot

    MoGraph Demi-god

  • Members
  • 483 posts
  • Gender:Male
  • Location:Brooklyn

Posted 18 October 2007 - 02:54 PM

cool, thx.

BTW - that gif ani rules! Where the hell is that from?

Guy got POPPED!

#15 chips

chips

    Newbie

  • Members
  • 35 posts

Posted 18 October 2007 - 03:01 PM

havent really used expressions in AE much.
want to test these though.
Do I create a new camera and alt click on it's position property and then copy one of these codes?

#16 graymachine

graymachine

    Red Giant Software

  • Members
  • 10,086 posts
  • Gender:Male
  • Location:Portland
  • Interests:0s, 1s, pixels and particles.

Posted 18 October 2007 - 03:02 PM


Harry Frank // graymachine.com


#17 graymachine

graymachine

    Red Giant Software

  • Members
  • 10,086 posts
  • Gender:Male
  • Location:Portland
  • Interests:0s, 1s, pixels and particles.

Posted 18 October 2007 - 03:23 PM

havent really used expressions in AE much.
want to test these though.
Do I create a new camera and alt click on it's position property and then copy one of these codes?


You put them on any property you want. The golden rule with expressions is:

Expressions ONLY do what you can otherwise do with keyframes. Their purpose is to simplify otherwise complex keyframe animation.

Harry Frank // graymachine.com


#18 pdeb

pdeb

    Newbie

  • Members
  • 11 posts

Posted 18 October 2007 - 04:13 PM

You put them on any property you want. The golden rule with expressions is:

Expressions ONLY do what you can otherwise do with keyframes. Their purpose is to simplify otherwise complex keyframe animation.


Well said, Harry, and great thread, it's spurred me to share one of my recent effects involving expressions:
a little while back I needed to make an oscillating or 'crenelated' spiral path:

http://members.shaw....cren_spiral.png

With the help of, who else, Dan Ebberts, and nab's Create Custom Effect script, I made this into an editable effect - it's tied to the Write-On effect, but you can easily pick-whip the output to any positional-based parameter.

It was created for a particular purpose (and perhaps limited in its use), but in the spirit of community, the archive is here:
http://members.shaw....ral_beta0.1.zip

the archive contains the AE7 .ffx preset, as well as the text you'll have to copy and paste into your "PresetEffects.xml" - if you feel comfortable tweaking that file, of course. As always, I recommend backing up your work and your .xml file.

Happy spiralling,
Peter Debay
Freelance After Effects Motion Graphics & Compositing
http://members.shaw.ca/pdebay

#19 pdeb

pdeb

    Newbie

  • Members
  • 11 posts

Posted 18 October 2007 - 04:22 PM

I would be remiss if I didn't post the position expression for those not wanting to download the custom effect:

center=[thisComp.width/2,thisComp.height/2];rMax = 240; //maximum radiusdecay = 0.3; //decayfreq = 6; //frequencyaStart = 0; //start angle offsetaRate = 220; //rotation rateoffsetFactor = 12; //smoothnessr = rMax/Math.exp(time*decay);a = degreesToRadians(aStart + aRate*time);offset = (r/offsetFactor)*Math.sin(freq*time*Math.PI*2);center + [Math.cos(a),Math.sin(a)]*(r + offset);

Happy spiralling,
Peter Debay
Freelance After Effects Motion Graphics & Compositing
http://members.shaw.ca/pdebay

Edited by pdeb, 18 October 2007 - 04:29 PM.


#20 C.Smith

C.Smith

    Sermonizes Mograph to the Masses

  • Members
  • 2,936 posts
  • Gender:Male
  • Location:Santa Monica
  • Interests:Keepin it real.

Posted 18 October 2007 - 07:00 PM

I did a quick mod of CS_VibrateNull with a stutter function to match the Jitter AE script above. (Stutter at zero equals stutter off).

Stutter
chris smith :: some of my work




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users