I am trying to code a simple butter fly the main part is contorting the animation speed.

The butter fly does two things
1. Flaps it's wings while on flowers. (So I need to control the animation speed for that.)

2. Fly away When you get close to it. (I am not sure what this involves but I guess it should fly in one direction and then vanish after 8 or 9 seconds.)