Experiment with recursion. Code could be much easier. It got a little messy because I wanted to do something quite different in the beginning (and I did't clean up).
Click on the image to get a new flower (position of the mouse affects look of the flower)
+ / - = more / less branches
n = new flower ( + mouse position changes look)
t = toggle flower mode