I'd like to make a sort of lfo to output an oscillating (various wave) value within a range.
In particular I would like to make a line that "scan" the whole canvas.
How can I do that?
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by john on 25 Feb, 2023 08:56 PM
Nodebox has a node for this: wave.
It can produce sine waves, square waves, triangle waves, and sawtooth waves. You define min and max values for the amplitude, the period, then an offset along the X axis. For any given offset, wave will return the height of the wave, which you can then plug into other nodes to draw shapes or make sounds.
In my Cartan Node Library I have another node, waveform, that takes the same values but, instead of a single offset, lets you provide start and end values for X. It then produces a path for that segment of the wave. By setting the start and end appropriately you can make the wave span the entire canvas or beyond.
Is that what you were asking for? If so, please confirm. If not, please explain in more detail what you are trying to do and I will try to help.
2 Posted by Congarou on 09 Mar, 2023 12:28 PM
Sorry for the late reply!
Thats exactly what I was looking for, but I would need to reset the wave, so the image is moving from left ot right of the screen and when it reach the end it restart from the beginning.
Hope it's clear:
Thanks a lot!
Support Staff 3 Posted by john on 10 Mar, 2023 12:46 AM
There are several different ways of making a waveform move across the screen. The attached demo shows two of them.
In the first (top) case I simply use the frame node to move the start and stop points of a waveform to the left while simultaneously scooting the wave itself to the right. When you hit Play you will see the wave moving from left to right across a space defined by the values in the two subtract nodes (in this case -200 to 200).
You can change any of the waveform settings as the movie is playing to see the effect: min, max, period, and type (sine, square, triangle, sawtooth).
The second (bottom) example shows how to create a line with single wave (a "blip") that moves across an oscilloscope screen. I do this by splicing a horizontal line segment before and after a single wave, moving the combined path horizontally to the right, and using the mask node to only show the area inside the screen. You can adjust the speed by multiplying the frame node.
To make this look right you will need to chop your wave neatly so that it starts and ends on the horizontal signal line. You will also need to use line segments longer than the width of the screen and a mod value greater than the screen width plus the wave width to ensure a smooth motion without any visible jumps when each cycle repeats. Experiment with the settings to get a feel for this.
Please let me know if this is what you need!