Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fakeTranslate = async() => {
- let charArray = fSelected().characters.split(" ")
- let wordslengths = charArray.map(i => i.length)
- if (wordslengths.every(i => i == 8)) return
- await figma.loadFontAsync( fSelected().fontName )
- const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
- function generateString(length) {
- let result = '';
- const charactersLength = characters.length;
- for ( let i = 0; i < length; i++ ) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result.toLowerCase();
- }
- for (let n = 0; n<charArray.length; n++) {
- if (wordslengths[n] <13) {
- if (!isNaN(charArray[n])) {continue}
- charArray[n] = charArray[n] + "s" + generateString(11-wordslengths[n])
- }
- }
- fSelected().name = fSelected().characters
- fSelected().characters = charArray.join(" ")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement