How to move Path


#1

Hello,
is there any easy way to move whole path? For example to the left?
I try to do display that will drawing in real time wave form of audio. So I need to move (slide) it in time fluently to the left with audio going. Something like osciloscope.


#2

I tried to find such method for Path in Juce documentation, but I can’t find it.


#3

You can use juce::Path::applyTransform()

For example moving 10px left:

Path p;

/* adding path points */

p.applyTransform(AffineTransform::translation(-10, 0));

#4

Thanks


#5

For a oscilloscope display though you’d probably want a static number of points, and shift the values “leftwards” in the container. Then each time you update the display your path just draws lines in the graph that correspond to your data points