Random curved motion across the screen


I need to create a random curved perpetual motion of point across the screen.
As if somebody moving a mouse constantly in large gestures.
Is there a technique for that ?

something similar to what’s discussed in this topic:


Hey! An ofPolyline would work well I think. It has a .curveTo() method for curving between points (catmull curve), which has a nice description in the documentation. You could generate a new ofPolyline as needed to continue the motion of the point. ofPolyline::curveTo() also has a curveResolution argument where you can set the resolution of the curve. And ofPolyline has a ton of other helpful methods.

There are many (infinite, really) possible different ways to do . . . the many possible ways of interpreting what you might mean by those words.

For example, you could start with a sin and cos to get the x and Y coordinates of the point, and have the angle more or less steadily increase, while also randomly varying the radius within a certain range, and/or randomly varying a multiplier for the x and y components. Or to make it smoother, you could have the variations of those factors also change using a different sin wave, and/or use other random functions with momentum.

For another example, you could have a steadily rotating perfect circle or ellipse location using sin/cos, but don’t show it. Instead, have it be the location that attracts the point(s) you do show, which could move either by a gravitational-type force, a constant force, an inverse gravitational force (stronger with distance from the attractor), or a particle with facing, rotation, and some range of speed.

Or any variety of other possible approaches.