Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Created December 3, 2016 02:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshCheek/c030e131d33ca09ac11cd8fa99d82059 to your computer and use it in GitHub Desktop.
Save JoshCheek/c030e131d33ca09ac11cd8fa99d82059 to your computer and use it in GitHub Desktop.
Drawing a circle
# 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