Animating a white dot to move along x axis with a fading "tail"
Hi Jitterbugs,
I'm currently working on a patch that triggers a random note for every COVID infection list in Ontario and BC. That query can be found under this forum post: https://cycling74.com/forums/sending-multiple-bangs-over-a-duration-to-trigger-random-notes-in-a-scale/replies/1#reply-611a836a04ac6d2ae8d00612
I'm now working on the visual side of this project and trying to get a white dot to move across the screen triggered by the same bang that produces the audio.
I managed to find a roundabout way of creating this by taking bits from the Jitter Tutorial #50 , and was able to create a white dot that moves across the screen:
The issues:
- Once a bang is sent, the currently active white dot is deleted and replaced by another dot. I would ideally like to have each bang trigger a white dot that completes the movement across the x axis, simultaneously. Can I duplicate this process using the patch that I've created, or am I barking up the wrong object?
-The image is aliasing when in fullscreen. It would be nice to have a smooth movement, and with a "tail" so that the dot looks more "comet"-like, with a tail of white behind it. Is there a way to create a smooth gradation that will create this effect?
-finally I want the same dot movement but reversed, so that I also have dots coming from the right side and moving towards the left as well. I tried to "reverse" the process by duplicating all the objects, but it caused the jit.window to just kinda glitch out?
Thanks for your time folks!
I would suggest using OpenGL for this. The most basic way to get trails on a moving object is to use jit.gl.pass @fxname smear, and setting your drawing context erase_color to 0 0 0 0. Adjust the smear effects erase_color alpha value to set the "length" of the trail.
For a slightly more advanced effect, capture the object to a jit.gl.node and blur the output before sending to another context (e.g. jit.world) with a jit.gl.pass @fxname smear. and jit.gl.pass @fxname bloom-hq is also fun (if not using Max 8.2 then simply change to @fxname bloom).
Thanks legendary Rob!
The "tail" looks perfect now, and I've managed to get one dot to move, very spookily across the screen.
One curious thing is that I'm having trouble getting the dot to populate off-screen on the left side, and then automatically move to the right end of the window. When I turn on the toggle, it appears that the dot appears more or less in the middle of the screen and then moves to the assigned coordinates. How can I get this to consistently start on the far end of the x axis (approx x= -2).
Also, not able to figure out what magic object I need to multiply this process so that I can have up to 72 dots moving across the screen simultaneously. Jit.gl.multiple was my first guess, but I'm having trouble getting it to connect to jit.gl.gridshape, and furthermore I think jit.gl.multiple would populate the dots all at once, as opposed to having them appear, one per 72 bangs.
Hope that makes sense! Here's the revised patch thus far...
make sure you spend some time with the documentation, especially the video and graphics tutorials, and the other OpenGL resources from the docs.
Also highly recommend the following video tutorials (a bit outdated but still a great introduction to Jitter, GL, and animation concepts):
So I had a helping hand in figuring out how to generate multiples of the same Gridshape (thanks Thomas!). What I actually ended up doing was borrowing from the MSP realm and using a poly~ to create 72 copies of the same dot moving patch. Huzzah! If any other newbie is similarly trying to create multiples of a jit.gl.gridshape this was definitely the fix I was looking for! You'll need all three patches in the same folder, etc. the parent patch is SmearDot.maxpatch
Hiroki to create multiple copies of a shape the most efficient way is to use [jit.gl.multiple]
https://youtu.be/sVt-5Xr53N4?t=106
Amazing! Frederico, love your work.
I actually spent the last week going over you jit.GEN series and particularly that video to see how jit.gl.multiple connects to jit.world.
I was at one point able to get the jit.gl.multiple to create a grid via the matrix, the way you set things up in the above video.
However, I was not able to figure out how I could then trigger each dot independantly to move across the screen the way I wanted them to.
I'm sure there's a way, but I couldn't understand why it didn't generate! Of course, the more I learn about Max, the more I see how there's multiple ways to get the results.
Sure!
I would really go into jit.gen, since it will allow you to really do everything you want in Jitter.