Scratch for Java

Pen::changeColor()

Change the color by a given amount. This does only have an effect on new points, which are created by setting the position.

Examples

import org.openpatch.scratch.Stage;
import org.openpatch.scratch.extensions.pen.Pen;

public class PenChangeColor {
  public PenChangeColor() {
    Stage myStage = new Stage(600, 240);
    Pen myPen = new Pen();
    myStage.add(myPen);
    myPen.setSize(10);
    while (myStage.getTimer().forMillis(3000)) {
      myPen.changeColor(10);
      myPen.down();
      myPen.goToRandomPosition();
      myPen.up();
      myStage.wait(200);
    }
    myStage.exit();
  }

  public static void main(String[] args) {
    new PenChangeColor();
  }
}

View on GitHub

Syntax

Java

.changeColor(amount)

Scratch

Parameters

NameData TypeDescription
amountfloatChanges the color by the amount.

Return

void