let’s wrap up, add gravity, make an array of particles generate on a mouse click, the effect can be anything from welding sparks to fireworks.
introduce popular open frameworks primitives like ofPoint, ofPolyline…
if you allow cheating (turn off auto background clear):
now, what if we need ofBackground
to be on? we need to store all of the points. shift to using a vector<float> x
and y
. introduce ofPoint
to simplify further. cap the size of the array at 100.
recode our draw app with an ofPolyline. show off some tricks that polyline can do, like smoothing.
getCharacterAsPoints
and grab the ofPolyline inside.polyline.getSmoothed()
getStringAsPoints
would require 3-nested loops