Skip to content

Commit

Permalink
refactoring, circle animation now OO
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesbowkett committed Jul 24, 2009
1 parent fb8a788 commit d9cc86b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion svg.erb
Expand Up @@ -4,7 +4,7 @@
<svg width="1028" height="720" viewBox="0 0 1028 720"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>tweeeeeen</desc>
<circle cx="<%= @cx %>" cy="<%= @cy %>" r="100"
<circle cx="<%= @circle.x %>" cy="<%= @circle.y %>" r="100"
fill="blue" stroke="blue" stroke-width="10" />
</svg>

10 changes: 6 additions & 4 deletions tweenr.rb
@@ -1,8 +1,10 @@
require 'erb'

@template = "svg.erb"
@cx = 0
@cy = 0

Circle = Struct.new(:x, :y)

@circle = Circle.new(0, 0)

def frame_id(number)
"output/tween#{sprintf("%.4d", number)}"
Expand All @@ -22,7 +24,7 @@ def graphic(number)
end

(0..100).each do |number|
@cx = number * 9
@cy = number * 7
@circle.x = number * 9
@circle.y = number * 7
graphic(number)
end

0 comments on commit d9cc86b

Please sign in to comment.