Scratch for Java

Pen::setTransparency()

Sets the pen's transparency to the percentage.

Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.pen.*;

public class PenSetTransparency {
  public PenSetTransparency() {
    Stage myStage = new Stage(600, 240);
    Pen myPen = new Pen();
    myStage.add(myPen);
    myPen.down();
    myPen.setSize(50);
    myPen.setTransparency(20);
    myPen.setPosition(0, 0);
    myPen.up();
    while (myStage.getTimer().forMillis(3000)) {}
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.setTransparency(percentage)

Scratch

Parameters

NameData TypeDescription
percentagefloatA value in percent in the range of 0 ... 255.

Return

void