Created
May 22, 2017 01:33
-
-
Save JoshCheek/2438c500e5d937e134e9eb6c19cf6617 to your computer and use it in GitHub Desktop.
Spin round
This file contains 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
require'io/console' | |
include Math | |
p,t=PI,"You spin me right round baby, right round round round." | |
.split(/\b/).flat_map.with_index{|w,i|w.chars.map{|c|"\e[9#{i%7+1}m#{c}"}}+ | |
(" "*10).chars | |
r,ø=t.size/2/p,2*p/t.size | |
$><<"\e[H\e[2J\e[?25l" | |
at_exit{$><<"\e[?25h"} | |
loop.with_index{|*,c|t.each.with_index(-c){|c,i|print"\e[#{ | |
(sin(ø*i)*r+r+1).to_i};#{(cos(ø*i)*r*2+r*2+1).to_i}H#{c}"} | |
sleep 0.1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment