Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: HomeForumBasicsExpressionsTutorialsPodcastsMotion GraphicsTrainingCinema 4DFAQ

Text expressions - can't work this out

Cow Forums : Adobe After Effects Expressions
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Text expressions - can't work this out
by Nick Hill on Aug 17, 2009 at 9:33:29 pm

OK. So I've read Dan Ebberts's helpful explanation at http://forums.creativecow.net/readpost/227/11461, and if I have a text layer with an animated position, to which I add an expression selector (and get the default selectorValue * textIndex/textTotal expression) this works fine, as expected. What I'm trying to do is have the text sort of drop in from above/below, overshoot, swing back, overshoot again... as if it's on a rubber band. It would eventually come to a halt. Harry J Frank's graymachine.com contains an expression to do this on something else, the nuts and bolts of which are


offset = (amp * Math.sin(freq*t*2*Math.PI)/Math.exp(t*decay));
// amp = amplitude, freq = frequency, t = time


So, combining the two (I freely admit I still don't fully understand expression selectors) I get


amp = 100;
decay = 1.5;
reps = 8;
freq = 3;
pc = selectorValue * textIndex/textTotal; // percentage you want to scale this effect by

o = text.animator("Animator 1").selector("Range Selector 1").offset;
// this is keyed between 0 and 100% with another 100% key later on to act as a "stop wobbling" indicator

if ((time - o.key(2).time)*freq*pc >= reps) {
t = 0;
} else {
t = (time - o.key(2).time) * pc;
}

wibble = (amp * Math.sin(freq*t*2*Math.PI)/Math.exp(t*decay));

if (time >= o.key(2).time) {
wibble
} else {
100
}


What happens is I get "invalid numeric result (divide by zero?)" at line 0 whenever I try to look at the layer. I can't work out why, but by eliminating the code line by line it seems to be to do with the selectorValue * textIndex/textTotal bit. If I leave this out, it's fine (but obviously nothing happens). Can anyone help?



Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Please post Expressions Code in the box below:


Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]