Adventures with Scribble!: Nothing Quite Like Playtime

I was feeling a little bored, so I opened up Scribble! (after a brief svn update) and decided to play around some.

I ended up making the RGB circle:

screenshot.png

While it obviously doesn’t blend to create that insanely cool effect, it looks cool anyway. 😀

During the process of this, however, something struck me… unless you’ve played with graphics before, none of the “average Joe Sixpack” users that Scribble! is designed for know the golden rule of computer graphics!

When you’re working with graphics on a computer, there’s a little “rule” that you operate under. The point of origin is the top left corner of the screen. There are of course many reasons for this, none of which I’ll trouble you with, but, to keep things brief, if you were to draw up a simple grid with X and Y axes, as far as computer graphics are concerned, you’re dealing with the IV (4th) quadrant.

Now that we’ve established that, looking at Scribble!’s code is easy.

size(360,300)
brush.stroke = 0, 0, 0, 0.7

This code establishes the two traits of the Scribble we’re working on before we start any drawing. We’ve set the size to 360 pixels wide and 300 pixels tall. Then we’ve set the stroke of the brush (don’t forget – this is still Ruby and method act on objects, in this case, the stroke is acting on the brush) to be black using RGB values (0 red, 0 green, and 0 blue is the combination for black) and have an opacity of 70%.

brush.fill = 1, 0, 1, 0.5
circle :center => [130,170], :radius => 75

Now, we begin by setting the color of our brush to Magenta (1 red, 0 green, 1 blue) and set its opacity to 50%. This next portion is a little bit trickier in terms of syntax, but it’s relatively simple to read. We’re creating a circle with a center point 130 pixels to the right of the origin and 170 pixels down from the origin. If we compared this to the coordinate sheet we envisioned earlier, our center point is at (130, -170). The next bit, the radius, is set to 75. Simple, no? The rest of the script is just placing two more circles of different colors on other parts of our canvas.

If you’ve got any interesting Scribbles you want to share, please comment! 🙂

Advertisements

0 Responses to “Adventures with Scribble!: Nothing Quite Like Playtime”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: