britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Per character effects #7

Closed subsoap closed 6 years ago

subsoap commented 6 years ago

A way to break words within special tags into individually characters and then be able to iterate over them to produce different effects.

Maybe something like Taste the <char class="rainbow">RAINBOW!</char> or <char class="doom">don't</char>

Would return two char numeric tables with a node for each character within the char tag allowing the char tables to be stored and their nodes iterated over to produce different effects.

dapetcu21 commented 6 years ago

Maybe just <char> should be enough. You could do:

Taste the <rainbow><char>RAINBOW!</char></rainbow> or <doom><char>don't</char></doom>

and then just use richtext.tagged(words, "rainbow") to get the chars for rainbow.

britzl commented 6 years ago

Added support for richtext.characters(word) to split a word into individual characters with correct tag settings and nodes positioned correctly. See example for sine-wave words.

https://github.com/britzl/defold-richtext/releases/tag/2.5.0