Skip to content

Instantly share code, notes, and snippets.

@sanket143
Created November 13, 2018 17:12
Show Gist options
  • Save sanket143/a2e882008aee8904db29eb416d5a48ee to your computer and use it in GitHub Desktop.
Save sanket143/a2e882008aee8904db29eb416d5a48ee to your computer and use it in GitHub Desktop.
require 'rmagick'
include Magick
Rows = 500
Cols = 500
$i = 0
loading = ImageList.new
while $i < 360 do
frame = Image.new(Cols, Rows) do |c|
c.background_color = "white"
end
circle = Draw.new
circle.fill_opacity(0)
circle.stroke_width(10)
circle.stroke("green")
circle.stroke_opacity(0.5)
if($i <= 180) then
circle.ellipse(frame.rows/2, frame.columns/2, 25, 25, 0, $i*2)
else
circle.ellipse(frame.rows/2, frame.columns/2, 25, 25, $i*2-360, 360)
end
circle.draw(frame)
loading << frame.copy
$i = $i + 10
loading.delay = 0.1
end
loading.write("loading.gif")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment