3 ms·
At the start of the program there is a for/in loop that goes over the properties of the canvas context, and adds a new property, with a shorter name, for each o
by glhaynes 16y ago
At the start of the program there is a for/in loop that goes over the properties of the canvas context, and adds a new property, with a shorter name, for each of them. It took some experimenting to find an abbreviation algorithm that doesn't have clashes on any of the methods we use---I ended up using the first letter of the name plus the the 7th letter, if any. So lineTo becomes l, and quadraticCurveTo becomes qt. I can then use these short names to actually access the methods---without ever having written out the full name.
Clever.