Skip to content

Commit

Permalink
Make the code is a bit more ugly but faster
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentisambart committed Jul 17, 2011
1 parent b2f6551 commit badcb95
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions slides.rb
Expand Up @@ -212,17 +212,12 @@ def keyDown(key)
end
end

HERE = File.expand_path("../examples", __FILE__)
red_colors = nil
blue_colors = nil
slide_manager.add_background do
c = self
c.background(Color.random)

# load images and grab colors
img = Image.new(File.join(HERE, 'images', 'italy.jpg')).saturation(1.9)
red_colors = img.colors(100)
img = Image.new(File.join(HERE, 'images', 'v2.jpg')).saturation(1.9)
blue_colors = img.colors(100)

# create flower head shape
head = Path.new.oval(0,0,10,10,:center)
petals = 3
Expand Down Expand Up @@ -284,7 +279,7 @@ def keyDown(key)
canvas.background(clr.copy.darken(0.6))

# create a new rope with 200 fibers
rope = Rope.new(canvas, :width => 100, :fibers => 50, :stroke_width => 0.4, :roundness => 3.0)
rope = Rope.new(canvas, :width => 100, :fibers => 30, :stroke_width => 0.4, :roundness => 3.0)

# randomly rotate the canvas from its center
canvas.translate(canvas.width/2, canvas.height/2)
Expand Down Expand Up @@ -321,4 +316,11 @@ def keyDown(key)
window.makeKeyAndOrderFront(nil)
window.orderFrontRegardless

# load images and grab colors
HERE = File.expand_path("../examples", __FILE__)
img = Image.new(File.join(HERE, 'images', 'italy.jpg')).saturation(1.9)
red_colors = img.colors(100)
img = Image.new(File.join(HERE, 'images', 'v2.jpg')).saturation(1.9)
blue_colors = img.colors(100)

app.run

0 comments on commit badcb95

Please sign in to comment.