use of javafx.util.Duration in project latexdraw by arnobl.
the class Canvas method setZoom.
@Override
public void setZoom(final double x, final double y, final double z) {
if (z <= getMaxZoom() && z >= getMinZoom() && !MathUtils.INST.equalsDouble(z, zoom.getValue())) {
zoom.setValue(z);
final Duration duration = Duration.millis(250);
final ParallelTransition parallelTransition = new ParallelTransition();
parallelTransition.getChildren().addAll(new Timeline(new KeyFrame(duration, new KeyValue(scaleYProperty(), z))), new Timeline(new KeyFrame(duration, new KeyValue(scaleXProperty(), z))));
parallelTransition.play();
setModified(true);
}
}
use of javafx.util.Duration in project org.csstudio.display.builder by kasemir.
the class TooltipSupport method hack_behavior.
private static void hack_behavior(final Object behavior, final String aspect, final int ms) throws Exception {
final Field field = behavior.getClass().getDeclaredField(aspect);
field.setAccessible(true);
final Timeline timer = (Timeline) field.get(behavior);
timer.getKeyFrames().clear();
timer.getKeyFrames().add(new KeyFrame(new Duration(ms)));
logger.log(Level.FINE, "Set Tooltip " + aspect + " to " + ms + " ms");
}
use of javafx.util.Duration in project contentment by GeePawHill.
the class VideoPlayerExperiment method start.
@Override
public void start(Stage stage) throws Exception {
Media media = new Media(new File("../core/src/main/resources/blackHandbraked.mp4").toURI().toString());
MediaPlayer player = new MediaPlayer(media);
player.pause();
player.setCycleCount(Integer.MAX_VALUE);
MediaView mediaView = new MediaView(player);
mediaView.setFitWidth(1280d);
BorderPane pane = new BorderPane();
pane.setCenter(mediaView);
ToolBar tools = new ToolBar();
Text total = new Text("TOTAL");
total.setStroke(Color.WHITE);
total.setFill(Color.BLUE);
total.setFont(new Font("Buxton Sketch", 60d));
tools.getItems().add(total);
Text time = new Text("HI MOM!");
time.setStroke(Color.WHITE);
time.setFill(Color.BLUE);
time.setFont(new Font("Buxton Sketch", 60d));
tools.getItems().add(time);
pane.setTop(tools);
player.currentTimeProperty().addListener(new ChangeListener<Duration>() {
@Override
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) {
double elapsed = ((double) player.getCurrentCount()) * player.getCycleDuration().toMillis() + newValue.toMillis();
time.setText("" + elapsed);
total.setText(player.getCycleDuration().toString());
}
});
player.setOnEndOfMedia(() -> System.out.println("End"));
stage.setScene(new Scene(pane));
stage.show();
player.play();
}
use of javafx.util.Duration in project Board-Instrumentation-Framework by intel.
the class DynamicTransition method ReadTransitionInformation.
public static DynamicTransition ReadTransitionInformation(FrameworkNode baseNode) {
DynamicTransition.Transition _TransitionType = DynamicTransition.Transition.NONE;
int _Transition_xGridCount = 10;
int _Transition_yGridCount = 10;
int _Transition_Delay = 100;
Color _Transition_Snapshot_Color_bg = Color.TRANSPARENT;
Duration _Transition_Duration = Duration.millis(1500);
for (FrameworkNode node : baseNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#Comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("Transition")) {
String strTransition = node.getTextContent();
_TransitionType = DynamicTransition.VerifyTransitionType(strTransition);
if (_TransitionType == DynamicTransition.Transition.INVALID) {
LOGGER.severe("Invalid Transition [" + strTransition + "] specified. Valid values are: " + DynamicTransition.names());
return null;
}
if (node.hasAttribute("xGrids")) {
_Transition_xGridCount = node.getIntegerAttribute("xGrids", 0);
if (_Transition_xGridCount <= 0) {
LOGGER.severe("Invlid xGrids value for Transition: " + node.getAttribute("xGrids"));
return null;
}
}
if (node.hasAttribute("yGrids")) {
_Transition_yGridCount = node.getIntegerAttribute("yGrids", 0);
if (_Transition_yGridCount <= 0) {
LOGGER.severe("Invlid yGrids value for Transition: " + node.getAttribute("yGrids"));
return null;
}
}
if (node.hasAttribute("Duration")) {
int Transition_Duration = node.getIntegerAttribute("Duration", 0);
if (Transition_Duration <= 0) {
LOGGER.severe("Invlid Duration value for Transition: " + node.getAttribute("Duration"));
return null;
}
_Transition_Duration = Duration.millis(Transition_Duration);
}
if (node.hasAttribute("Delay")) {
_Transition_Delay = node.getIntegerAttribute("Delay", 0);
if (_Transition_Delay <= 0) {
LOGGER.severe("Invlid Delay value for Transition: " + node.getAttribute("Delay"));
return null;
}
}
// nuking this, s not really needed anymore
// if (node.hasAttribute("Background"))
// {
// String strColor = node.getAttribute("Background");
// try
// {
// _Transition_Snapshot_Color_bg = Color.web(strColor);
// }
// catch (Exception e)
// {
// LOGGER.severe("Invalid Background value for getTransition: " + strColor);
// return false;
// }
// }
}
}
DynamicTransition objTransition = new DynamicTransition(_TransitionType);
objTransition.setDelay(_Transition_Delay);
objTransition.setDuration(_Transition_Duration);
objTransition.setNoOfTilesX(_Transition_xGridCount);
objTransition.setNoOfTilesY(_Transition_yGridCount);
objTransition.setSnapshotColor(_Transition_Snapshot_Color_bg);
// _objTransition = objTransition;
return objTransition;
}
use of javafx.util.Duration in project lttng-scope by lttng.
the class LoadingOverlay method fadeOut.
public synchronized void fadeOut() {
if (fCurrentFadeOut != null) {
/* We're already fading out, let it continue. */
return;
}
if (fCurrentFadeIn != null) {
fCurrentFadeIn.pause();
fCurrentFadeIn = null;
}
double fullOpacity = fOpts.loadingOverlayFullOpacity.get();
double transparentOpacity = fOpts.loadingOverlayTransparentOpacity.get();
double fullFadeOutDuration = fOpts.loadingOverlayFadeOutDuration.get();
double startOpacity = getOpacity();
/* Do a rule-of-three to determine the duration of fade-in we need. */
double neededDuration = (startOpacity / fullOpacity) * fullFadeOutDuration;
FadeTransition fadeOut = new FadeTransition(new Duration(neededDuration), this);
fadeOut.setFromValue(startOpacity);
fadeOut.setToValue(transparentOpacity);
fadeOut.play();
fCurrentFadeOut = fadeOut;
}
Aggregations