Created
November 13, 2018 17:12
-
-
Save sanket143/a2e882008aee8904db29eb416d5a48ee to your computer and use it in GitHub Desktop.
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 '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