After Effects

Currently Being Moderated

creating a single variable from a simple formula

Aug 21, 2012 1:08 AM

Tags:

Hi guys,

I'm ploughing my way through the basics of expressions, constantly running into syntax errors as I still haven't found out the logic behind it all. It is still a great mystery to me when to use spaces, [ ] { } and ( ) not to mention =.

I was trying to create a variable called "y" from a simple formula. My scripting looks like:

veloc = 3;

amplitude = -5;

decay = 0;

y = amplitude*Math.sin(veloc*time)/Math.exp(decay*time);

[value[0],y[1]]

But whatever brackets and things I put around this formula, whatever spaces or newlines, somehow AE doesn't accept it. When I replace the formula for a wiggle, the fifth line is accepted, and when I replace the "Y" in the fifth line for "value" there are no errors, so obviously AE considers the formula not valid. What is the difference between the output that wiggle(,) gives and the output of this formula? How should I write this expression? Is there any website resource where the logic behind the bracket, spacing, newline, order etc. of this script language is demystified? And I mean really at basic, really baby level. I am pretty good at maths, but the programming hieroglyphs and their secret rules still don't make sense to me.

Any help is greatly, greatly appreciated.

Replies
• Currently Being Moderated
Aug 21, 2012 2:05 AM   in reply to Lewiz

Simply just use y. You are calculating a 1D value, so there's no need to address any sub-components.

Mylenium

|
Mark as:
• Currently Being Moderated
Aug 21, 2012 2:19 AM   in reply to Lewiz

You misunderstand. y is a 1D variable:

[value[0],y]

That's al lyou need.

|
Mark as:
• Currently Being Moderated
Aug 21, 2012 2:42 AM   in reply to Lewiz

Yepp, multi-dimensional property streams are enumerated arrays and you adress individual sub-sets with their component index. No array, no hocus-pocus.

Mylenium

|
Mark as:
• Currently Being Moderated
Aug 21, 2012 10:48 AM   in reply to Lewiz

In the future you can also check out the After Effects Expressions Forum:  http://forums.adobe.com/community/aftereffects_general_discussion/afte reffects_expressions?view=discussions

Also, Dan Ebberts website is a very good resource for learning the basics of expressions:  http://www.motionscript.com/

|
Mark as:
Actions

More Like This

• Retrieving data ...