FORUMS: list search recent posts

Multiply Position; "Must be a scalar"

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Anders Hattne
Multiply Position; "Must be a scalar"
on Mar 2, 2019 at 5:44:14 pm

...whatever that means..!
I've had a google around, to no avail.
Why won't
transform.position * [0, -1];
not work?

I'd have to do something like this to make that work..
a = transform.position;
[a[0], a[1]*-1]

Is there no other way?

Figure I'd get that cleared up after years of confusion...!

Return to posts index

Oleg Pirogov
Re: Multiply Position; "Must be a scalar"
on Mar 3, 2019 at 3:44:47 am

Well, cause one of the arguments of * operation 'must be a scalar'. Smth like that would work in Python but not in Javascript.

[a[0], a[1]]*[1, -1] = [a[0], a[1]*(-1)] is element-wise multiplication. It exists in JS's as math.dotMultiply(x, y) but is not implemented in AE's expressions.

Return to posts index

Anders Hattne
Re: Multiply Position; "Must be a scalar"
on Mar 4, 2019 at 12:05:49 pm

ooohkay.. I googled "javascript scalar" (..and later "element-wise multiplication").
"A Scalar is a variable that holds an individual value."

That cleared that up!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved