Scratch for Java

Pen::changeTransparency()

Change the transparency 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 PenChangeTransparency {
  public PenChangeTransparency() {
    Stage myStage = new Stage(600, 240);
    Pen myPen = new Pen();
    myStage.add(myPen);
    myPen.setSize(10);
    while (myStage.getTimer().forMillis(3000)) {
      myPen.changeTransparency(10);
      myPen.down();
      myPen.goToRandomPosition();
      myPen.up();
      myStage.wait(200);
    }
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.changeTransparency(amount)

Scratch

Parameters

NameData TypeDescription
amountfloatChanges the transparency by the amount.

Return

void