rootpublicationssketches and applicationsthe node
hello there little node
the node


The node is a general purpose computational object capable of self-locomotion, message passing, information storage, and some degree of arbitrary free will.

As it exists in this context, the node is an extension of the Flash MX Movieclip Object. This implies that the node possesses all the methods and properties the Movieclip Object provides in addition to some specialized behavior.


 
It is fundamental to watch something that moves. It follows then, that it is far more interesting for an computational interface to have some visibly moving parts. The node is an easy way to expose the working parts of the system as visible objects.
 
 

Specialized behavior is primarily the ability to move and scale to internally defined destinations. Later the node will be expanded to include much more complicated behavior including connections to other nodes. Connections will prove an interesting adaptation of the node.

"All things are built up in parts - our bodies, our minds, our food, our roads. Even our atomic particles have proven to be organizations of yet smaller constituents. In most cases the elements at any generalized scale are self similar, sometimes identical."

So let's define the mechanics of the most basic node in accordance with object oriented conventions in Flash MX. Using a couple of Actionscript methods and some of our own well defined functions, we'll enlighten our node object so that it can do some simple things, both on its own and under the direction of outside influences.

The easiest way to understand how to prototype the node object is to get right into it.

There are three absolutely critical elements that must be defined in order for any object in Flash MX to be prototyped. They are as follows:


 
 
// construct the node object
function node() {
}


// extend the MovieClip class
node.prototype = new MovieClip();


// register node supaclass
Object.registerClass("mcNode",node);
            
 


What are the advantages to prototyping the node Object?
Prototyping the node object provides the developer with several advantages. A prototyped object is easy to instantiate and maintain. Using a prototyped object requires only one line of code to create a new node. Also, after the node has been created, we need not worry about controlling it, as everything it needs to know about how to behave is internally defined. Second, the prototyped object is fast. Essentially, less computational overhead is required to maintain the node in the Flash environment. This is advantageous if we decide we would like to have several nodes existing concurrently or if other processes are occurring which require their own computational time.
 
 

With each new instantiation of the node, this code is executed. This frees us from the tedium of defining each node manually upon creation.

 
 

The node is also the basic computational entity that enables us to build complex systems sometimes exhibiting emergent behavior. This is explained in great detail


 
 


There are many variations expanding on the basic node:


3D Node
3D Anaglypic Node
Binary Switch Node
Layer Composite Node
Life Pattern Node

Papa Smurf Node

 
 
figure. adding a bit of color and random geometric patterns to each node creates a seemingly biologic organism
 
 




// prototype functions
node.prototype.move = function () {
  // gravitate towards destination
  var fx=(this.dx-this._x)/20;
  var fy=(this.dy-this._y)/20; 
  this.vx+=fx;
  this.vy+=fy;
     
  // apply inertia
  this._x+=this.vx;
  this._y+=this.vy;
              
  // apply friction
  this.vx*=.75;
  this.vy*=.75;
}

node.prototype.freewill = function() {
  // wait around and arbitrarily decided to pick a new destination
  this.setDestination(random(150)+25,random(150)+25);
}

node.prototype.setDestination = function(x,y) {
  this.dx=x;
  this.dy=y;
}

node.prototype.isAtDestination = function() {
  // return true if position is within 1 pixel of destination
  if ((Math.abs(this._x-this.dx)+Math.abs(this._y-this.dy))<1) {
    return true;
  } else {
    return false;
  }
}
		  
 


Occasionally nodes will connect to themselves, or to other nodes, who in turn connect back. Instances of these connection schemes provides for a feedback loop with potentially external interference. Feedback loops with no external interference are considered to be self-modifing.

Connected nodes form Node Gardens.



 
  jtarbell, July 2002  


 
commercial free open source since 2012 spread the love