# AE ENHANCERS

Expressions/Scripts/Presets
 It is currently Thu May 23, 2013 3:12 am

 All times are UTC - 8 hours [ DST ]

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Camera After Motion Between FramesPosted: Wed Oct 31, 2007 1:41 pm

Joined: Mon Apr 30, 2007 5:55 am
Posts: 157
Location: United States, Ohio
Hi All,

I have been trying to do camera after motion.
I have this expression:
Code:
t = time- key(2).time;
if (t < 0) {
value;
}
else
{
veloc =28;
amplitude = 60;
decay =2.05;
x = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
y = amplitude*Math.sin(veloc*t)/Math.exp(decay*t);
value + [x,y];
}

Which does work if place it in the position field of the camera.

However, it only works for two keyframes.
In my comp I have a camera which starts off far away, then moves into view and stops. This takes up two keyframes. After the second keyframe the expression code kicks in and does a slight wobble on the camera.

What I would like to do, is to allow multiple camera moves and stops with the wobble only kicking in between the stops.

I'm wondering how I could modify the expression to achieve this functionality?

Thanks

Top

 Post subject: Posted: Wed Oct 31, 2007 2:15 pm

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
This might do what you want. It should cause the wobble at each even numbered keyframe - the assumption being that the even numbered keyframes are hold keyframes and the camera travels between odd and even keyframes.

Code:
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
if (n%2)n--;
}
if (n == 0){
value;
}else{
t = time - key(n).time;
veloc =28;
amplitude = 60;
decay =2.05;
x = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
y = amplitude*Math.sin(veloc*t)/Math.exp(decay*t);
value + [x,y];
}

Dan

_________________
http://www.motionscript.com

Top

 Post subject: Posted: Thu Nov 01, 2007 6:56 am

Joined: Mon Apr 30, 2007 5:55 am
Posts: 157
Location: United States, Ohio
Thanks Dan,

That looks like it works!

Hmmm...
An interesting side effect of this expression is that is crashes After Effects 7 if you change the length of your comp.
Here is the work flow for creating the crash.

1.)Make a new comp that is 10 seconds long.
2.)Add some text and turn on the 3D switch.
4.)Paste the expression code into the position property of the camera.
5.)Set four keyframes for the camera with some space inbetween to observe the after motion effect.
6.)Press the insert key and preview the animation.
7.)Now use CTRL-K and change the time from 10 seconds to 5 seconds.

I'm not eactly sure what causes the crash, but if you preview a couple of times after you have reduced the length of the comp, then click to interupt the preview you get a (0::42) crash.

Seems to work fine if you do not change the comp length.
Just thought I'd mention the caveat.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC - 8 hours [ DST ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Announcements    Announcements Expressions    Expressions Library    Expressions Tutorials    Expression Discussion Scripts    General Scripts Library    Script Tutorials    Scripts Discussion    Script requests User Scripts    Paul Tuersley's Scripts    Impudent 1's Scripts Animation Presets    Animation presets Library