Permalink
Browse files

init

  • Loading branch information...
0 parents commit a9fe8ce25bb06d8803783edd93a97adc41ef8c3c @gilesbowkett committed Jul 23, 2009
Showing with 31 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +10 −0 svg.erb
  3. +20 −0 tweenr.rb
@@ -0,0 +1 @@
+*.swp
10 svg.erb
@@ -0,0 +1,10 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<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"
+ fill="blue" stroke="blue" stroke-width="10" />
+</svg>
+
@@ -0,0 +1,20 @@
+require 'erb'
+
+@template = "svg.erb"
+@cx = 0
+@cy = 0
+
+def frame_id(number)
+ "output/tween#{sprintf("%.4d", number)}"
+end
+
+(0..100).each do |number|
+ @cx = number * 9
+ @cy = number * 7
+ File.open("#{frame_id(number)}.svg", "w") do |file|
+ file.write ERB.new(File.read(@template)).result(binding)
+ end
+ system("convert #{frame_id(number)}.svg #{frame_id(number)}.jpg")
+ File.unlink("#{frame_id(number)}.svg")
+end
+

0 comments on commit a9fe8ce

Please sign in to comment.