w = effect("Slider Control")("Slider")+1;
The “+1” is the problem. I guess it is not related to time therefore the “.valueAtTime” can’t work with it (this is my guess maybe I’m wrong).
A simple solution would be to add the “+1” at the end of the last line BUT what if you really need this extra value to be taken into account in the “w” variable? And in a single expression (no extra slider created).
ValueAtTime only apllies to properties. If you take the value of the slider and add 1, it is an integer. Not a property anymore.
So if the slider is 2 at second 2 and 3 at second 3, you can ask what value it had at which second. But if you add something, let’s say at second 2, asking valueAtTime then is like asking what value does 3 have at another second. 3 is 3. Does not change value. That is why you must add it at the last line, where first you ask how big is the slider at given time and then add the number.
If you really need the extra value to be taken into account in the w and not in the last line, you make 2 variables(w plus another one without the “+1”). And use the other one in the last line, then add one.
Thank you for your answer Andrei, it is making much more sense now!
But I’m not sure to understand your solution to let a variable with a property + an integer (like “+ 1”) taken into account by valueAtTime? Could you write it?