a port of the Processing Visualization Language
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.
Usage Web & Application

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub