Iterates of a circle map

Consider the function f(x)=2x (mod 1). We can view this function as a function from the circle to the circle in which a point with central angle maps to a point with central angle (In our figure, the easternmost point corresponds to ) If we iterate this function and connect each point to the previous point, then the for most starting points, the envelope of lines produces a cardioid. (Note: You can move the starting point A and the slider controls the number of iterations of the function.)