Key Up/Down Mk2
Yesterday I posted an improvement to Cyberfunk's composition for using key up/down. However, if you used the output to rotate a cube for instance, it was very juddery - so I got to thinking if there was another way …
I proudly present the Javascript Key Up/Down version. Basically, it takes the input of the key, divides it by the value of a passed multiplier and adds or takes the result away from the stored value. When applied as a value to a cube's rotation, you get smooth rotation.
`
var prevScaledTime = outputs[0];
var dummy = inputs[0];
var speed = Number( inputs[1] );
var speed2 = Number( inputs[2] );
var mult = Number( inputs[3] );
outputs[0] = (prevScaledTime + speed/mult - speed2/mult) || 0;
`
Enjoy. SteamSHIFT out.
Technorati Tags:
quartz composer, mac, osx, experiments