FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

this

   
Examples  
float ypos = 50; 
 
void setup() { 
  size(100, 100); 
  noLoop(); 
} 
 
void draw() { 
  line(0, 0, 100, ypos); 
  this.ypos = 100; 
  line(0, 0, 100, ypos); 
} 
 


import processing.video.*; 
Movie myMovie; 
 
void setup() { 
  size(200, 200); 
  background(0); 
  myMovie = new Movie(this, "totoro.mov"); 
  myMovie.loop(); 
} 
 
void draw() { 
  if(myMovie.available()) { 
    myMovie.read(); 
  } 
  image(myMovie, 0, 0); 
} 
 

Description   Refers to the current object (i.e. "this object"). In Processing, it's most common to use this to pass a reference from the current object into one of the libraries. The keyword this can also be used in another way, but it is often not necessay. For example, if you are calling the filter() method of a PImage object named tree from another object, you would write tree.filter(). To call this method inside PImage itself one could simply write filter() or could more explicity write this.filter(). It's not incorrect to say this.filter() but it is not necessary as this is always implied.
   
Syntax  
this
   
Usage   Web & Application
   
 
 






   
 
Updated: Fri Jul 15 16:36:15 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info