Last active
November 20, 2018 00:51
-
-
Save aferriss/bb76e9ba094cafbc43b3c0cdd1c83d22 to your computer and use it in GitHub Desktop.
letters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var index = 0 | |
var originalText = "Love" | |
var text = originalText | |
/// Letters is just an array of structs with information about character, fontSize, character width/height | |
var textPathLength = letters.map({$0.width}).reduce(0, +) /// The total length of my word before I start adding letters | |
while textPathLength.f < perimeter { | |
text += originalText[index] | |
textPathLength += letters[index].width | |
index = (index + 1) % originalText.count | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment