Don Havey

Sustainably harvested information

Archive for April, 2008

Tutorial #6: Colliders  

Colliders previewHere’s another brief tutorial. This one relates to object collisions and velocity transfers. Basically, we’re making simulated billiard balls: objects that bounce off each other and the sides of the applet. Not too much else to introduce, so I’ll just get started…

What it looks like

Here are the files: Collider classes

And here’s the final result: I’m a super collider

Click on the applet to rejuvenate each Collider’s y-velocity and prepare for another round of bouncy goodness. If you find the motion blur distracting, you can always look at this blur-free example.

What you’ll learn

Some of the math you’ll have to decipher yourself, but in general, I’ll touch on each of the following:

  • Preventing circular shapes from overlapping.
  • Constraining points within an area.
  • Transferring velocities upon object collision.
  • And I’ll show you how to do that cheesy motion blur trick… if you don’t already know.

Ready?

Read more…

The article has

no responses yet

Written by Don

April 29th, 2008 at 9:56 am

Inverse-kinematic springy grass  

IK grass previewThis isn’t a formal tutorial… just a source code dump. I made this randomized, springy IK grass in Flash for Curiobot a while ago, but decided that it was too CPU-intensive to risk combining with all of the DOM-scripting on the site. As such, I didn’t bother optimizing it much, so that’s up to you.

The files: IK grass classes

The final result: Springy IK grass

Click on the stage and then move your mouse left and right to simulate a breeze through the grass.

The variables contained in the .fla are pretty well labeled… you shouldn’t have any trouble playing around with them. I’m afraid the thing was built in Flash MX 2004… so it’s AS2.0, not AS3.0. But it wouldn’t be hard to convert… it’s already OOPed. I think I’ll put it into Processing soon. Should run much better.

Enjoy!

The article has

no responses yet

Written by Don

April 28th, 2008 at 9:31 am

Tutorial #5: The IP-mapping globe  

Earth previewHumans love maps. They love the mapping of any type of information, not strictly geographical. Maps are bursting with information. They transcend the boundaries of language. Maps are good.

I’m going to make a map today. Well, a globe. It’s going to be a very basic extension of our icosahedron-based sphere. We’ll translate a bunch of latitude/longitude pairs into three-dimensional coordinates to visually define the countries, then we’ll add a single marker on the globe that represents the user’s location, based on his or her IP address.

What it looks like

Here’s our completed Earth class: The final result

And here are the classes you’ll need: Earth classes

What you’ll learn

  • Translating latitude/longitude pairs to Points
  • Mapping an IP address to a physical location via Geobytes and PHP

Sounds like fun, right?

Read more…

The article has

3 responses

Written by Don

April 24th, 2008 at 12:09 pm

Nice quote on Google today  

The “Quote of the Day” gadget on my Google homepage brings you this profound thought from John le CarrĂ©:

Coming home from very lonely places, all of us go a little mad: whether from great personal success, or just an all-night drive, we are the sole survivors of a world no one else has ever seen.

An elegant string of words.

The article has

no responses yet

Written by Don

April 24th, 2008 at 9:18 am

Categories: Etcetera

Tags: ,

Tutorial #4: A tree made of letters  

Lettertree previewA couple of years ago I was walking home from work and thinking about how writing to a blog is often a one-way process. Like talking to a wall. The most important part of the process, for most bloggers, is the creation of an entry: the release of words. The importance of readability decreases quickly after an entry has been written. Frequently it is an introspective process, like writing to a diary or talking to yourself.

I thought, I would like to create objects from blog entries. Objects that would contain the words in the entry and grow as more words are added, but remain illegible, thereby deemphasizing the creation of a document.

To make a long story short: I decided that a tree would be an appropriate object: it grows in a recognizable fashion and can expand nearly indefinitely. The lettertree concept was born.

This tutorial will explain how I approached the lettertree problem. It relies on our existing Tree class. We’ll create paths from the root of the tree to each “bud” and randomly select one of these paths to carry a letter. We’ll also increase the thickness of the tree branches as the thing grows.

Here’s what it looks like: The final result

Here’s what you need: Lettertree classes

Note that like many of the applets I post, I’ve switched the rendering method from OpenGL to P3D for the in-browser sample. The OpenGL results will look way better and (typically) run faster within the Processing environment, but the latest version of the Java plugin is so immensely bloated that P3D seems to render faster in a browser.

Ready to begin?

Read more…

The article has

one response

Written by Don

April 22nd, 2008 at 2:58 pm

If you like unicorns…  

Survival of the PrettiestVote for my tshirt design at uneetee: Survival of the Prettiest.

I’m afraid you have to register for the site in order to vote, but it’s a good place to find nice shirts, anyways.

Much obliged!

The article has

no responses yet

Written by Don

April 21st, 2008 at 11:26 pm