Forum Replies Created
June 3, 2022 at 1:48 pm
Not gonna lie, you guys lost me about two turns back. Followed most of that but some was way deeper than my piddling expression knowledge goes. Going to file it under “don’t do it like this” and go back to banging rocks together. Really appreciate you both taking a look at it! Hopefully it was a fun little brain-teaser.
On the plus side, my boss thought the working project was basically magic, so happy ending, at least.
June 1, 2022 at 11:00 pm
I agree it’s baffling. I can’t see any reason for this behavior. I was able to patch around it by killing the math and just altering the array values to be what I needed, but I have no idea why it’s doing what it’s doing. Thanks for looking at it. Glad it wasn’t some super-simple mistake I made.
May 31, 2022 at 8:06 pm
Here is a super-streamlined version. I commented the heck out of the code to hopefully show the trouble spots.
May 31, 2022 at 7:22 pm
Happy to. Let me clean it up a little and I’ll post it up.
May 31, 2022 at 5:15 pm
Added weirdness: I just put a placeholder value at array since it will never get called (there will always be at least 1 visible layer) and the expression broke if array was not a number. Doesn’t matter that value is not being used, After Effects isn’t having it. Using the same code in Source Text on a text layer is fine, but anything non-numeric simply existing in the array causes a fail in any other property.
May 31, 2022 at 5:01 pm
Messing around with it more, and have found everything works as expected and the math is all fine UNTIL I use it to call the value from the array. I checked and nothing is less than 0, I get the expected values at every step, but as soon as I subtract 1 (this value is confirmed to be not less than 0) and pass that to the array call, After Effects flips out. Stranger still, if I ADD 1, it works.
So if X=2 and I add 1 and pass that to the array I get, as expected, the value in the array. And passing X unmodified to the array call gives me array. But if X=2 and I subtract 1, I do not get the value in array but the error “Undefined value used in expression.” However setting a variable to X-1 and just using that as my final value does indeed give me 1.
No idea what hidden magic is causing this to fail, but I’m just going to adjust my array values to match the returned value without doing any math to it.
May 28, 2022 at 8:35 pm
Appreciate the answer but that’s not what I’m after. I’m adding the five alpha values to get Total, then I just want to subtract 1 from Total and After Effects freaks out. “Add five numbers then subtract one from that sum” seems simple enough, but AE refuses. Are sampleImage() alpha values strings and not numerical values? Can’t imagine why they would be but I can’t think of another reason why this should fail.
May 27, 2022 at 5:59 pm
I suppose I could just alter the array values to work with the returned value, but I want to understand why this isn’t working. Sure seems like it should. Pretty basic math, I thought.
August 23, 2021 at 1:47 pm
Amazing! After reading your explanation and examples, I can now consistently put Layer b pretty much where I want on Layer a. More importantly, I think I now understand the syntax enough to make it work on more complex future projects (and probably sort out fromComp and toWorld). Thank you so much for finally sinking this into my brain!
If you ever publish an After effects book, I’ll preorder 3 copies and hand out the extras to coworkers.
April 27, 2021 at 1:58 pm
Once I changed the tracking type to Before, that worked like a charm. Still don’t fully get how textIndex works but this helps it make a bit more sense. Thank you so much!