Copy link to clipboard
Copied
Writing an expression to control the scale of a layer.
I'm using variable t to represent a value between 0 and 1.
At t=0, the expression:
(1-t)^2
returns the number 3. The expected value is 1.
Meanhile, (1-t)*(1-t) returns the correct value of 1.
This makes me think I am denoting exponents incorrectly altogther-- that the carrot "^" is NOT how you represent "to the power of" in AE expressions.
Can someone explain what's going on here?
Correct. Exponents are Math.pow(base,exponent). Nothing specific to AE, general JavaScript math and there are enough web sites out there that explain it. The ^ on the other hand would be a special operator to enforce bytewise processing, which isn't even relevant for AE, only for certain web engines.
Mylenium
Instead of ^, use **:
t=0;
(1-t)**2
Copy link to clipboard
Copied
Correct. Exponents are Math.pow(base,exponent). Nothing specific to AE, general JavaScript math and there are enough web sites out there that explain it. The ^ on the other hand would be a special operator to enforce bytewise processing, which isn't even relevant for AE, only for certain web engines.
Mylenium
Copy link to clipboard
Copied
great, thanks @Mylenium
Copy link to clipboard
Copied
Instead of ^, use **:
t=0;
(1-t)**2
Copy link to clipboard
Copied
Ahh of course! Forgot to try that. That's how it works in Python too. Thanks Dan.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now