Scratch for Java

AnimatedSprite::getAnimationInterval()

Gets the current animation interval.

Examples

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

public class AnimatedSpriteGetAnimationInterval {
  public AnimatedSpriteGetAnimationInterval() {
    Stage myStage = new Stage(600, 240);
    AnimatedSprite bee = new AnimatedSprite();
    bee.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
    myStage.add(bee);
    bee.changeY(30);

    while (myStage.getTimer().forMillis(2000)) {
      bee.playAnimation("idle");
      bee.say("Interval: " + bee.getAnimationInterval());
    }
    bee.setAnimationInterval(20);
    myStage.getTimer().reset();
    while (myStage.getTimer().forMillis(2000)) {
      bee.playAnimation("idle");
      bee.say("Interval: " + bee.getAnimationInterval());
    }
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.getAnimationInterval()

Scratch

Return

int