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.
Hi Mylenium, thanks for your fast answer. I tried both
veloc = 3;
amplitude = -5;
decay = 0;
y = amplitude*Math.sin(veloc*time)/Math.exp(decay*time);
[y[1]]
and
veloc = 3;
amplitude = -5;
decay = 0;
y = amplitude*Math.sin(veloc*time)/Math.exp(decay*time);
y[1]
but it's a big no-go still. I am really not getting the logic of the format. AE reports Class 'Number' has no property or method named '1', or that the outcome should be of dimension 2, not 1. Any more ideas?
Holy Tortellini.
I knew it would be simple, but this simple... So I understand that [value[0]] just picks the current value of the current parameter like being an array of two (2D) or three (3D) values: [0] for x, [1] for y and [2] for z. [0] just stands for the first value in this array, right? And then the y is already a determined value so it doesn't need any extra sh*t around it. (Excuse me).
Well, great! Thanks a lot! I am starting to get the picture here - slowly. Cheers mate!
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/
North America
Europe, Middle East and Africa
Asia Pacific