Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

Object

   
Examples  
// Declare and contruct two objects (h1, h2) from the class HLine 
HLine h1 = new HLine(20, 1.0); 
HLine h2 = new HLine(50, 5.0); 
 
void setup() { 
  size(200, 200); 
} 
 
void loop() { 
  if(h2.speed > 1.0) { 
    h2.speed -= 0.01; 
  } 
  h1.update(); 
  h2.update();  
} 
 
class HLine { 
  float ypos, speed; 
  HLine (float y, float s) {  
    ypos = y; 
    speed = s; 
  } 
  void update() { 
    ypos += speed; 
    if (ypos > width) { 
      ypos = 0; 
    } 
    line(0, ypos, width, ypos); 
  } 
} 

Description   Objects are instance of classes. A class is a specification for a grouping of related methods (functions) and data (variables and constants).
   
Syntax  
class instance
   
Parameters  
class   the class to created the object from

instance   any variable name

   
Usage   Web & Application
   
   
© 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas