karaoke(str, frame) { const chars = (frame % (str.length + 20)) - 10; if (chars < 0) { return chalk.white(str); } return chalk.rgb(255, 187, 0).bold(str.substr(0, chars)) + chalk.white(str.substr(chars)); }
radar(str, frame) { const depth = Math.floor(Math.min(str.length, str.length * 0.2)); const step = Math.floor(255 / depth); const globalPos = frame % (str.length + depth); const chars = []; for (let i = 0, length = str.length; i < length; i++) { const pos = -(i - globalPos); if (pos > 0 && pos <= depth - 1) { const shade = (depth - pos) * step; chars.push(chalk.rgb(shade, shade, shade)(str[i])); } else { chars.push(' '); } } return chars.join(''); }