Snellen text effect

The way it works is to extract the text from the target element (container) and split it into words. Then create a line of text and add words to it until it is wider than the container, whence the last word added is removed. This process is repeated with decreasing font size over the desired number of lines, or until there are no more words. It is left as an exercise for the reader to extend this function such that it calculates the optimal number of lines for a given text.