Movement on curve?


I’m working on a project where I need to create move “clouds” on a curve. The clouds should be able to move from botton to top of the curve AND I need to move a cloud to the center (or x/y pos) of the curve.

This picture expains a bit how the curve / clouds should work:

Does someone have an idea how I can move the clouds over this curve and be able to move the “clouds” to a certain position in the curve? Each cloud will be an Object.


you’re talking about spline following. i think chris posted some stuff to do with this - have a look in the examples thread. it was around June/July this year…

hi damian,

I was googling and reading up on Perling noise. See this page:…-perlin.htm

I’m a noob on this, but it seems perfect to create a motion on a curve. Actually I don’t even need a perlin noise function, interpolating between some points seems to be enough… I’m not sure if I’m correct… so please correct me if so.


perlin noise is way overkill for what you want to do.

yeah, interpolating will do it. just set up a series of points, and move between them one by one. depending on the algorithm, you’ll get nicer or not so nice motion. the most simple kind is linear interpolation, which moves in a straight line between two points, does a sharp turn (ie it instantly changes direction) when it reaches the the second point, and moves in a straight line toward the next point. depending on how close together your waypoints are this can look good or not so good.

for nicer motion (curves), you need to look into splines, aka Bezier curves, aka something else too, i forget what; or, you can model the motion of the clouds by giving each cloud a velocity and only applying force (ie acceleration) to the velocity: each frame you accelerate the cloud toward a waypoint, then when it reaches that or near enough to that, you set the acceleration toward the next waypoint. you have to keep the parameters under control or it can start to look like drunk speed racers. this is probably not going to work so well with clouds, in any case.

if it’s generating the curves in the first place that you’re wondering about, well then there’s a bunch of ways of doing it. easiest would be to pick a sequence random x-points within some bands of y-values… if that makes sense… this probably isn’t going to look so hot though.

Hi Damian,

I was indeed googling on interpolation techniques and found some using cos(). Using physics to control the movement of the clouds seems also a possiblity… but first I want to try to interpolate.

Lets say I’ve got these points:
a) 10,500
b) 100,400
c) 150, 200
d) 100, 100
e) 50, 0

As interpolation (cos()), works on 2 points I think I need to use the following pseudo code to get the points between a,b,c,d and e.

// get time for each point  
1 / points.length = 0.2   
// interpolate between points  
for (point in points) {    
 // how would i use the time in here ;-).. or on how many points should I interpolate?  
 nextpoint =;  
 new x = interpolate(point.x, nextpoint.x, [what should Iput here?]);  
 nex y = interpolate(point.x, newpoint.y, [?]  


a cosine-based interpolation scheme is going to kind of lurch between the points, coming to a complete halt at each waypoint, which is probably not what you want …

have a look here
specifically the ‘movement along bezier curves’ stuff


and maybe his: - the cppglue - Utility library for openFrameworks from eriksjodin

and: from jesusgollonet

then i found this thread have it all: