Adding total-chars/total-words/total-lines classes to parent elements.#70
Adding total-chars/total-words/total-lines classes to parent elements.#70Abby805 wants to merge 1 commit intodavatron5000:masterfrom
Conversation
|
Thanks for this Abby. Some questions. It doesn't look like you're leveraging |
|
Hi Dave! Sorry, I thought the test case was just supposed to show that it worked from a purely js standpoint. The main use case I was envisioning was styling letters into an arch (such as the h1 on http://www.nointernetsalestax.com/), in which case the proper rotation of each letter would depend on the total number of letters. I can also think of scenarios involving color (say you want your first letter to be black and your last to be white, and each letter in between to be a slightly lighter shade of gray - oversimplified example, but you would need to know how many characters there were in order to make it even). I can write these up as demos if you'd like. It could definitely be done with an .each() statement, but since I could only really envision doing that in conjunction with lettering.js I thought it made more sense to include it (and even if someone doesn't need it, I can't envision any way it would be harmful). But that's your call, of course. :) |
|
Here's an example of using this functionality to fade a word of unknown length evenly between two colors: http://codepen.io/Abby805/pen/qbMyGZ |
This adds a class of total-chars-{n} to the element to which lettering() is applied. For example, where previously we would see:
...now we see:
This will also add a class of total-words-{n} when lettering('words') is applied, and a class of total-lines-{n} when lettering('lines') is applied.
Reduced test cases: http://codepen.io/Abby805/pen/KVBRqw