Both things you mention are perfectly possible, but you seem to want an easy solution because AVS's way of doing it is too complex...
Well don't know about you, but I prefer powerful vs. easy to a certain degree.
If you want to switch between two numbers, you can use an alternating condition. For example:
Every time this statement is executed, the value of 'c' is negated. If it is true (non-zero), then it becomes false (zero) and vice-versa. If you don't initialise 'c' yourself, it will start out 0, which means false.
So suppose that you wanted a movement to alternate between a fast and slow zoom, you could use:
In fact you seem to be a bit intimidated by AVS's powerful scripting abilities. A good place to start is to try and copy AVS's built-in effects. The little zoom code above is a good example of how to imitate a "Blitter Feedback". Once you know how to do basic effects, you can combine them into new, complicated things.
Something that is interesting to know is when you want a variable (e.g. a zoom factor) to move towards a new value rather than jumping to it.
Suppose your target value is "vt" and your current value is "vc". You could use:
What this code does is replace 20% of 'vc' value with vt's value. This is easy to understand with a numeric example. Suppose vc starts out as 0 and vt as 1, then the value of vc will evolve like this every time the statement is executed:
0, (0*0.8 + 0.2) = 0.2, (0.2*0.8 + 0.2) = 0.36, (0.36*0.8 + 0.2) = 0.488, 0.5904, ...
You can see how it moves towards the target value. Notice too that the jumps between 2 values decrease as 'vc' gets closer to 'vt'.
Suppose you wanted it to change value at a constant rate though. You could use:
vc=vc + 0.1*sign(vt-vc);
Let's see what's going on. The sign() function returns '1' for positive numbers, and '-1' for negative numbers. So we first check the sign of (vt-vc), to see if we need to go up or down. Then, we use the result of sign(), multiply it by 0.1 and add it to our existing value.
In our previous example (vc=0, vt=1), vc will evolve linearly:
0, 0.1, 0.2, ..., 0.9, 1
There's a small problem with this code though: it doesn't stop. So suppose your 'vc' was 0, and 'vt' was 0.15. Then vc will evolve like this:
0, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, ...
. As you can see, it 'wobbles' around the value, because it becomes too large after the jump from 0.1 to 0.2.
To prevent this, you could check if the distance between vc and vt is less than the jump value (0.1 in our case), and if it is, we jump directly to vt because we're close enough.
Our new improved code is: