Expressions and vector math help
Hello!
I have a few relatively basic questions about After Effects expressions and vector maths.
1. First off (just to get my naming right) when we're talking about data types and we use the word vector, does vector imply an array of 3 dimensions?
2. For arrays of 4 dimensions (ex. RGBA) do we call this a vector4 in After Effects? Or simply an array of 4 dimensions?
3. What's the easiest way to do math where the data types don't have the same dimension? Ex. float1 + vector3. Take a look at the following expression:
myVector = [0.1, 0.1, 0.1];
myFloat = 0.2;
myResult = myFloat + myVector;
[myResult]The result here is [0.3, 0.1, 0.1]
So what's the easiest way to get a result of [0.3, 0.3, 0.3]? Or how do I convert 0.2 to [0.2, 0.2, 0.2]?
4. What's the easiest way to round a vector?
myVector = [2.59, 6.72, 15.34];
myResult = Math.round(myVector);
[myResult]The result here is "NaN"
5. Where can I find references of all of After Effects expressions? I found this doc, but it seems to be incomplete.
https://ae-expressions.docsforadobe.dev/index.html
For example, there is no mention of Math.round().
6. Is there a way to explicitely define data type when declaring a variable in an expression?
Thanks!
