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(254, 100);
    Pen myPen = new Pen();
    myStage.add(myPen);
    myPen.down();
    myPen.setSize(10);
    myPen.setTransparency(20);
    myPen.setPosition(120, 45);
    myStage.wait(500);
    Window.getInstance().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