Adventures with Scribble!: The Basics of Basics

Scribble! has been undergoing many changes lately to prepare for the mystical and (at least in my case) anticipated 0.1 release.

But the important thing to remember about Scribble!, is that, just like Hackety Hack, its goal is to teach people how to program without breaking out the boring lectures about “Hey this is syntax. Do it.” It’s a tool for beginners to learn a little bit about graphics using Cairo and Ruby to have a little fun and expand their knowledge.

So, you ask me, how does Scribble! do it?

Pretend we take the following code and drop it into Scribble!:

#Set Canvas Size to 500x500!
size(500,500)
brush.fill = 0, 0, 0.9, 0.04 #Uses standard "Red, Green, Blue, Opacity" values
brush.stroke = 0, 0, 0, 0.1 #Same as above

#I like circles too! ^_^
30.times do
  circle :center => [rand(size[0]), rand(size[1])], :radius => (rand(size[0]) - 150)
end

#Draw a cool spiral thing that Evan Farrar came up with. B)
scribble(250,250) do |s|
  s.curve 250, 300
  s.curve 300, 250
  s.curve 250, 200
  s.curve 200, 250
  s.curve 250, 350
  s.curve 350, 250
  s.curve 250, 150
  s.curve 150, 250
  s.curve 250, 400
end

## And to top it off, a blue smiley face over everything!
scribble(100, 10) do |s|
  s.line(100, 60)
  s.jump(150, 10)
  s.line(150, 60)
  s.jump(80, 70)
  s.curve(125, 90)
  s.curve(170, 70)
end

The code is, of course, a little commented (mainly because I’m a nice guy, <3), so it shouldn’t take too much explanation. In fact, once you look at the image below, it shouldn’t take any at all!

Scribble! here, Scribble! there…. hell Scribble! everywhere!

So, I encourage you to go pick up Scribble from SVN and play around some:
svn co svn://hamptoncatlin.com/scribble/trunk scribble

To run it, cd to ‘/path/to/scribble’ and run ‘bin/scribble’. If you come up with anything neat, share it with me!

0 Responses to “Adventures with Scribble!: The Basics of Basics”



  1. No Comments Yet

Leave a Reply