本文整理匯總了Java中javafx.animation.AnimationTimer.stop方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimationTimer.stop方法的具體用法?Java AnimationTimer.stop怎麽用?Java AnimationTimer.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.AnimationTimer
的用法示例。
在下文中一共展示了AnimationTimer.stop方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Smoke
import javafx.animation.AnimationTimer; //導入方法依賴的package包/類
public Smoke() {
running = false;
ctx = getGraphicsContext2D();
width = getWidth();
height = getHeight();
particles = new CopyOnWriteArrayList<>();
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(final long NOW) {
if (NOW > lastTimerCall + GENERATION_RATE) {
if (running && particles.size() < NO_OF_PARTICLES) particles.add(new ImageParticle());
if (particles.isEmpty()) timer.stop();
lastTimerCall = NOW;
}
draw();
}
};
registerListeners();
}
示例2: VuMeterSkin
import javafx.animation.AnimationTimer; //導入方法依賴的package包/類
public VuMeterSkin(final VuMeter CONTROL) {
super(CONTROL);
active = false;
lastTimerCall = 0l;
stepSize = new SimpleDoubleProperty((getSkinnable().getMaxValue() - getSkinnable().getMinValue()) / getSkinnable().getNoOfLeds());
timer = new AnimationTimer() {
@Override public void handle(final long NOW) {
if (NOW > lastTimerCall + PEAK_TIMEOUT) {
leds.get(peakLedIndex).getStyleClass().remove("led-peak");
peakLedIndex = Orientation.HORIZONTAL == getSkinnable().getOrientation() ? 0 : leds.size() - 1;
timer.stop();
}
}
};
init();
initGraphics();
registerListeners();
}
示例3: LedBargraphSkin
import javafx.animation.AnimationTimer; //導入方法依賴的package包/類
public LedBargraphSkin(final LedBargraph CONTROL) {
super(CONTROL);
ledList = new ArrayList<>(getSkinnable().getNoOfLeds());
stepSize = new SimpleDoubleProperty(1.0 / getSkinnable().getNoOfLeds());
lastTimerCall = 0l;
peakLedIndex = 0;
timer = new AnimationTimer() {
@Override public void handle(final long NOW) {
if (NOW > lastTimerCall + PEAK_TIMEOUT) {
ledList.get(peakLedIndex).setOn(false);
peakLedIndex = 0;
timer.stop();
}
}
};
init();
initGraphics();
registerListeners();
}
示例4: init
import javafx.animation.AnimationTimer; //導入方法依賴的package包/類
public ChromaFxPreviewWindow init() {
Pane previewPane = new Pane();
final WritableImage img = new WritableImage(width, height);
ImageView imageView = new ImageView();
imageView.setScaleY(-1.0);
imageView.setImage(img);
previewPane.getChildren().add(imageView);
// TODO: parallelize?
animationTimer = new AnimationTimer() {
@Override
public void handle(long now) {
if (chroma.hasChanges()) {
img.getPixelWriter().setPixels(0, 0, width, height, PixelFormat.getByteRgbInstance(), chroma.getCurrentFrame(), 0, height * 3);
}
}
};
animationTimer.stop();
setOnHiding(event -> animationTimer.stop());
setOnShowing(event -> animationTimer.start());
setTitle("Chroma Preview");
setScene(new Scene(previewPane, width, height));
return this;
}
示例5: Led
import javafx.animation.AnimationTimer; //導入方法依賴的package包/類
public Led(final Color LED_COLOR, final boolean FRAME_VISIBLE, final long INTERVAL, final boolean BLINKING) {
getStylesheets().add(Led.class.getResource("led.css").toExternalForm());
getStyleClass().add("led");
_ledColor = LED_COLOR;
_frameVisible = FRAME_VISIBLE;
_interval = INTERVAL;
_blinking = BLINKING;
toggle = false;
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(final long NOW) {
if (NOW > lastTimerCall + getInterval()) {
toggle ^= true;
setOn(toggle);
lastTimerCall = NOW;
}
}
};
init();
initGraphics();
registerListeners();
if (_blinking) {
timer.start();
} else {
timer.stop();
}
}