I'm currently working on an iphone application where there should be "Electrical power flows" visualised from a plug to a device.
I've made this a static line, but it would be way nicer if there was some way that those lines could be replaced by particles, showing an actual flow rather than a simple connection.
So for example device A is at position 100,50 and the plug is at position 200,300. I want particles to start emitting from 200,300 and 'flow' to point 100,50 and stop there.
I've concidered gravity, but as more than 1 device will be in the screen at the same time, this will probably be messed up?
Doing this staticly isn't a solution either: the devices can be moved around the screen and the particles should follow.
EDIT:
In the end a friend of me helped me out:
There is this point X1, y1 and point x2, y2
So to calculate the angle where to go to:
dx = 100 - 200
dy = 50 - 300
speed = 100;
alpha = arctan2(dy,dx)
distance = sqrt(dx*dx + dy*dy)
set emittercell litetime = distance / speed
set emittercell speed = speed
set emittercel emissionlongitude = alpha
and done!