- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name | ### this
Examples |
    float ypos = 50;

    void setup() {
      size(100, 100);
      noLoop();
    }

    void draw() {
      line(0, 0, 100, ypos);
      // "this" references the Processing sketch,
      // and is not necessary in this case
      this.ypos = 100;
      line(0, 0, 100, ypos);
    }
    import processing.video.*;
    Movie myMovie;

    void setup() {
      size(200, 200);
      background(0);
      // "this" references the Processing sketch
      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"), which will change depending on the context in which this is referenced. 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 to reference an object's own method from within itself, but such usage is typically not necessary. 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 the PImage object itself, one could simply write filter() or, more explicitly, this.filter(). The additional level of specificity in this.filter() is not necessary, as it is always implied.

Updated on January 9, 2020 00:33:17pm EST