-
Coding syntax question
Hi there,
this is slightly OT, like the last post I made — but a quick question I hope for the coding experts.I’m trying to port a bit of code out of AE, to an environment that supports short mathematical expressions but unfortunately doesn’t support all of the normal Javascript operators.
In the example below, there is usage of the “/=” operator and the “–” operator, and they’re not supported. My problem is they’re implemented in this bit of code (yes this particular bit is one of the well-known Penner easing equations) in a somewhat complex way such that I’m having trouble figuring out how to re-write the definition without them. Particularly, the use of “/=” inside the if condition is throwing me…
function easeInOut (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }Anyone care to take a shot at it? I'd appreciate a brief explanation too, if you don't mind -- curious to understand exactly how to deconstruct this
Lu Nelson
Berlin, Germany
--
[MacProQ2.66, 8GB, Sys10.5.6, FCP 6.0.5, AE 9.0.2]