While bees collect nectar from flowers to make food, pollen attaches to the bees’ hairy bodies. As the bees move on, pollen spreads around the flowers. It’s quite neat – the bees get their food from the flowers, while the flowers are able to reproduce in the process! Such a relationship where both species benefit is known as a mutualistic relationship.
Click anywhere on the landscape to make the bee fly there. If you click in the middle of a flower, the bee will land on the flower and will even sway with it. Look a little closer, and you can see the wings stop beating when you land!
“Wow, that’s one realistic-looking bee!”
The bee’s landing animation is controlled by a “bend” factor. Different parts of the bee are rotated at different degrees based on how much “bend” the bee has.
You can also think of the bend factor as how “ready” the bee is to start flying. The bee will not start to move to a different location unless it is more than 80% “ready” to fly.
Here’s a brief breakdown of the parts of the bee:
- The head. Contains eyes and antennae.
- The fluffy yellow ball of hair behind the head (yes, I’m using very scientific language here). Made of 180 hairs, set 2 degrees apart. Each hair is a line bent at four locations at randomized offsets.
- The striped body. Made of a set of 6 ellipses alternating between yellow and brown. Each ellipse’s height varies sinusoidally. The body rotates independently based on the “bend” factor.
- The legs. Each leg also rotates based on the “bend” factor, at a larger degree than the body does. They are anchored at the point where they are attached to the body.
- The wings. The amplitude of the wing beats depends on the “bend” factor – if the bee is fully landed, the wings won’t beat.
This program was one of the five winning entries of Khan Academy‘s “Ecological Interactions” programming contest, which ran from April 8, 2015 to April 28, 2015. I received a special Golden Winston Badge to display in my Khan Academy profile.