Male genitals... though they risk ludicrousness by their rubbery indecisiveness, have a rational mathematical design, a syntax.
- Sexual Personae, Camille Paglia
In the pen15.js library, a Penis is made of two essential sub-systems: a Spring and a CumParticleSystem. The Spring controls the display of the penis image, and the CumParticleSystem creates CumParticles.
Spring
The Spring is responsible for controlling the width and height of the penis image. It follows the physics of a spring...
F = k(x - x0)
When the cum function is triggered, the displacement of the spring is set to 100 (this can be changed by changing the initialDisplacement variable). The update function then recalculates the displacement over each loop.