Scratch for Java

Pen::changeTransparency()

Change the transparency by a step

Examples

import org.openpatch.scratch.Stage;
import org.openpatch.scratch.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(step)

Parameters

Name Data Type Description
step double the step to change the transparency by

Return

void

changeTransparency()

Create Shareable URL

Select Sections