Scratch for Java

Stage::setTransparency()

Sets the stage's backdrop transparency to the percentage.

Examples

import org.openpatch.scratch.*;

public class StageSetTransparency {
  public StageSetTransparency() {
    Stage myStage = new Stage(600, 240);
    myStage.addBackdrop("forest", "assets/background_forest.png");
    myStage.wait(2000);
    myStage.setTransparency(50);
    ;
    myStage.wait(2000);
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.setTransparency(percentage)

Scratch

Parameters

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

Return

void