Sample&hold/soft takeover question

blackburst's picture

Hi guys I'm trying to make a layer opacity selector for vdmx and I've hit a bit of a brick wall. The idea is to have number keys that when held down enable mouse x control of the layer opacities. I made a comp with sample and holds (see attached) which works as expected except that when I start sampling the mouse value it obviously jumps straight to that value. It really needs to just add or subtract to/from the current value with the mouse position to avoid these jumps in opacity. How can I offset the current mouse position to create a new "0" point? Any help would be greatly appreciated. Cheers.

PreviewAttachmentSize
Layer Opacity S&H.qtz10.01 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: Sample&hold/soft takeover question

I don't have vdmx to test your patch but I would suggest trying to use inertia and or smooth patches. I guess the idea is sample and hold with your mouse when you hit a number key. What this will do is sample and hold the mouse value when your using the mouse storing let's say the last known mouse opacity position. If I'm reading correctly you the next time you decide change the opacity layer etc...

The value jumps to your new mouse position Soon as you hit the number key again. to make the value go from your old position to new position smoothly add a smooth patch with a larger smooth setting. this will make it so the old sampled mouse potion will float smoothlymto the new position. The tricky part is that you will have to use some multiplexers and logic to test the distance. Ypu will need to use the distance to figure out when the old coords are the same as the new coords. A conditional patch will work for that. The reasoning behind this is that you do not want to start sampling again until your old value and new value are the same. you will also want to switch from smoothed back to regular tracking. That is what the multiplexor is for. You could also use the inertia patch to do something similar wth the friction settings.

don't know if I read you correctly but your expecting a similar behavior to the trackball. Where when you lift ypur mouse and then back down again the tracking doesn't abruptly jump to new your new mouse position.

blackburst's picture
Re: Sample&hold/soft takeover question

Thanks dust, yeah I guess a bit like the trackball in the sense that wherever you click becomes the current value and you can raise or lower from there. I don't want it to pickup only when the current value is reached, and I don't want it to smoothly drop or rise to the new value once clicked, I want the click pos to become the current value. I suppose I'd have to multiply it so that the scale becomes such that I don't get caught near the edge of the screen with nowhere to go, but that's pretty straight forward. Still can't figure out how I would make it.

dust's picture
Re: Sample&hold/soft takeover question

if you add another sample and hold and use you mouse button to sample with you will always have the current value of the mouse stored. you can then use that in comparison to the value you stored when hitting a number key and figure out he distance between the current mouse left button sampler and your number key sampler and add or subtract the difference to get your opacity to where your mouse is ? not really sure that is an interesting question though.