Created
December 3, 2016 02:03
-
-
Save JoshCheek/c030e131d33ca09ac11cd8fa99d82059 to your computer and use it in GitHub Desktop.
Drawing a circle
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
# https://twitter.com/josh_cheek/status/804868012620779521 | |
radius = 21 | |
0.step by: 1 do |degrees| | |
angle = degrees*Math::PI/180 | |
y = (radius * (Math.sin(angle) / 2 + 1)).to_i | |
x = (radius * (Math.cos(angle) / 2 + 1)).to_i | |
print "\e[#{y};#{2*x}HXX" | |
sleep 0.01 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment