Here are the examples of the java api javafx.animation.Transition.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
11 Examples
16
Source : IconsController.java
with GNU Lesser General Public License v3.0
from javafxchina
with GNU Lesser General Public License v3.0
from javafxchina
private void bindAction(JFXHamburger burger) {
burger.setOnMouseClicked((e) -> {
final Transition burgerAnimation = burger.getAnimation();
burgerAnimation.setRate(burgerAnimation.getRate() * -1);
burgerAnimation.play();
});
}
15
Source : SliderSkin.java
with MIT License
from HayaKus
with MIT License
from HayaKus
/**
* Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
*/
void positionThumb(final boolean animate) {
Slider s = getSkinnable();
// this can happen if we are bound to something
if (s.getValue() > s.getMax())
return;
boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) / (s.getMax() - s.getMin()))) - thumbWidth / 2)) : thumbLeft;
final double endY = (horizontal) ? thumbTop : snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) / // - thumbHeight/2
(s.getMax() - s.getMin())));
if (animate) {
// lets animate the thumb transition
final double startX = thumb.getLayoutX();
final double startY = thumb.getLayoutY();
Transition transition = new Transition() {
{
setCycleDuration(Duration.millis(200));
}
@Override
protected void interpolate(double frac) {
if (!Double.isNaN(startX)) {
thumb.setLayoutX(startX + frac * (endX - startX));
}
if (!Double.isNaN(startY)) {
thumb.setLayoutY(startY + frac * (endY - startY));
}
}
};
transition.play();
} else {
thumb.setLayoutX(endX);
thumb.setLayoutY(endY);
}
}
15
Source : IosSliderSkin.java
with Apache License 2.0
from HanSolo
with Apache License 2.0
from HanSolo
private void positionThumb(final boolean ANIMATE) {
Slider s = getSkinnable();
// this can happen if we are bound to something
if (s.getValue() > s.getMax())
return;
final boolean HORIZONTAL = s.getOrientation() == Orientation.HORIZONTAL;
final double END_X = (HORIZONTAL) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) / (s.getMax() - s.getMin()))) - thumbWidth / 2)) : thumbLeft;
// - thumbHeight/2
final double END_Y = (HORIZONTAL) ? thumbTop : snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) / (s.getMax() - s.getMin())));
if (ANIMATE) {
// lets animate the thumb transition
final double START_X = thumb.getLayoutX();
final double START_Y = thumb.getLayoutY();
Transition transition = new Transition() {
{
setCycleDuration(Duration.millis(200));
}
@Override
protected void interpolate(double frac) {
if (!Double.isNaN(START_X)) {
thumb.setLayoutX(START_X + frac * (END_X - START_X));
}
if (!Double.isNaN(START_Y)) {
thumb.setLayoutY(START_Y + frac * (END_Y - START_Y));
}
}
};
transition.play();
} else {
thumb.setLayoutX(END_X);
thumb.setLayoutY(END_Y);
}
}
14
Source : CustomOptions.java
with GNU General Public License v3.0
from bithatch
with GNU General Public License v3.0
from bithatch
@FXML
void evtShowTimeline() {
timelineHidden = false;
PREFS.putBoolean(PREF_TIMELINE_VISIBLE, true);
double pos = PREFS.getDouble(PREF_TIMELINE_DIVIDER, 0.75);
Transition slideTransition = new Transition() {
{
setCycleDuration(Duration.millis(200));
}
@Override
protected void interpolate(double frac) {
double p = 1 - ((1 - pos) * frac);
split.setDividerPositions(p);
}
};
slideTransition.onFinishedProperty().set((e) -> timelineContainer.visibleProperty().set(true));
slideTransition.setAutoReverse(false);
slideTransition.setCycleCount(1);
slideTransition.play();
}
13
Source : WhereIsIt.java
with GNU General Public License v3.0
from GazePlay
with GNU General Public License v3.0
from GazePlay
@Override
public void launch() {
gameContext.setLimiterAvailable();
final int numberOfImagesToDisplayPerRound = nbLines * nbColumns;
log.debug("numberOfImagesToDisplayPerRound = {}", numberOfImagesToDisplayPerRound);
final int winnerImageIndexAmongDisplayedImages = randomGenerator.nextInt(numberOfImagesToDisplayPerRound);
log.debug("winnerImageIndexAmongDisplayedImages = {}", winnerImageIndexAmongDisplayedImages);
currentRoundDetails = pickAndBuildRandomPictures(numberOfImagesToDisplayPerRound, randomGenerator, winnerImageIndexAmongDisplayedImages);
if (currentRoundDetails != null) {
final Transition animation = createQuestionTransition(currentRoundDetails.getQuestion(), currentRoundDetails.getPictos());
animation.play();
if (currentRoundDetails.getQuestionSoundPath() != null) {
playQuestionSound();
}
}
stats.notifyNewRoundReady();
gameContext.getGazeDeviceManager().addStats(stats);
gameContext.firstStart();
}
13
Source : CustomOptions.java
with GNU General Public License v3.0
from bithatch
with GNU General Public License v3.0
from bithatch
@FXML
void evtHideTimeline() {
PREFS.putDouble(PREF_TIMELINE_DIVIDER, split.getDividerPositions()[0]);
timelineContainer.visibleProperty().set(false);
PREFS.putBoolean(PREF_TIMELINE_VISIBLE, false);
double pos = split.getDividerPositions()[0];
Transition slideTransition = new Transition() {
{
setCycleDuration(Duration.millis(200));
}
@Override
protected void interpolate(double frac) {
split.setDividerPositions(pos + ((1f - pos) * frac));
}
};
slideTransition.onFinishedProperty().set((e) -> {
Platform.runLater(() -> timelineHidden = true);
});
slideTransition.setAutoReverse(false);
slideTransition.setCycleCount(1);
slideTransition.play();
}
12
Source : AprendendoTransicoes.java
with GNU General Public License v3.0
from jesuino
with GNU General Public License v3.0
from jesuino
private void acaoTocar(final Button btnParar, final Button btnTocar, final Button btnPausar, final Button btnAjusta) {
// antes de tocar, pegamos a mais nova transição selecionada
Transicoes t = (Transicoes) botoesTransicao.getSelectedToggle().getUserData();
transicaoAtual = FabricaTransicao.fazerTransicao(t, sldTempo.getValue(), alvo);
// lógicas de habilitação dos botões, temos que setar todas as
// vezes pq trocamos as transições
btnParar.disableProperty().bind(transicaoAtual.statusProperty().isNotEqualTo(Status.RUNNING));
btnTocar.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
btnPausar.disableProperty().bind(transicaoAtual.statusProperty().isNotEqualTo(Status.RUNNING));
btnAjusta.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
sldTempo.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
System.out.println("Tocando transição " + t);
transicaoAtual.play();
}
10
Source : PrimaryViewController.java
with MIT License
from charlescao460
with MIT License
from charlescao460
private void initializeDrawer() {
drawer.setOverLayVisible(false);
drawer.setSidePane(listView);
drawer.toBack();
drawer.setOnDrawerOpening(e -> {
final Transition animation = hamburger.getAnimation();
animation.setRate(1);
mainPane.setEffect(new BoxBlur(5, 5, 10));
drawer.toFront();
animation.play();
});
drawer.setOnDrawerClosing(e -> {
final Transition animation = hamburger.getAnimation();
animation.setRate(-1);
mainPane.setEffect(null);
animation.play();
drawer.toBack();
});
}
6
Source : XToolsController.java
with GNU Lesser General Public License v3.0
from AnyListen
with GNU Lesser General Public License v3.0
from AnyListen
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() throws Exception {
// init the replacedle hamburger icon
final JFXTooltip burgerTooltip = new JFXTooltip("Open drawer");
drawer.setOnDrawerOpening(e -> {
final Transition animation = replacedleBurger.getAnimation();
burgerTooltip.setText("Close drawer");
animation.setRate(1);
animation.play();
});
drawer.setOnDrawerClosing(e -> {
final Transition animation = replacedleBurger.getAnimation();
burgerTooltip.setText("Open drawer");
animation.setRate(-1);
animation.play();
});
replacedleBurgerContainer.setOnMouseClicked(e -> {
if (drawer.isClosed() || drawer.isClosing()) {
drawer.open();
} else {
drawer.close();
}
});
FXMLLoader loader = new FXMLLoader(getClreplaced().getResource("/fxml/ui/MainPopup.fxml"));
loader.setController(new InputController());
toolbarPopup = new JFXPopup(loader.load());
optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15));
JFXTooltip.setVisibleDuration(Duration.millis(3000));
JFXTooltip.install(replacedleBurgerContainer, burgerTooltip, Pos.BOTTOM_CENTER);
// create the inner flow and content
context = new ViewFlowContext();
// set the default controller
Flow innerFlow = new Flow(ButtonController.clreplaced);
final FlowHandler flowHandler = innerFlow.createHandler(context);
context.register("ContentFlowHandler", flowHandler);
context.register("ContentFlow", innerFlow);
final Duration containerAnimationDuration = Duration.millis(320);
drawer.setContent(flowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
context.register("ContentPane", drawer.getContent().get(0));
// side controller will add links to the content flow
Flow sideMenuFlow = new Flow(SideMenuController.clreplaced);
final FlowHandler sideMenuFlowHandler = sideMenuFlow.createHandler(context);
drawer.setSidePane(sideMenuFlowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
}
5
Source : MainController.java
with GNU Lesser General Public License v3.0
from javafxchina
with GNU Lesser General Public License v3.0
from javafxchina
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() throws Exception {
// init the replacedle hamburger icon
drawer.setOnDrawerOpening(e -> {
final Transition animation = replacedleBurger.getAnimation();
animation.setRate(1);
animation.play();
});
drawer.setOnDrawerClosing(e -> {
final Transition animation = replacedleBurger.getAnimation();
animation.setRate(-1);
animation.play();
});
replacedleBurgerContainer.setOnMouseClicked(e -> {
if (drawer.isClosed() || drawer.isClosing()) {
drawer.open();
} else {
drawer.close();
}
});
FXMLLoader loader = new FXMLLoader(getClreplaced().getResource("/fxml/ui/popup/MainPopup.fxml"));
loader.setController(new InputController());
toolbarPopup = new JFXPopup(loader.load());
optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, PopupVPosition.TOP, PopupHPosition.RIGHT, -12, 15));
// create the inner flow and content
context = new ViewFlowContext();
// set the default controller
Flow innerFlow = new Flow(ButtonController.clreplaced);
final FlowHandler flowHandler = innerFlow.createHandler(context);
context.register("ContentFlowHandler", flowHandler);
context.register("ContentFlow", innerFlow);
final Duration containerAnimationDuration = Duration.millis(320);
drawer.setContent(flowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
context.register("ContentPane", drawer.getContent().get(0));
// side controller will add links to the content flow
Flow sideMenuFlow = new Flow(SideMenuController.clreplaced);
final FlowHandler sideMenuFlowHandler = sideMenuFlow.createHandler(context);
drawer.setSidePane(sideMenuFlowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
}
4
Source : Primary.java
with Apache License 2.0
from Aloento
with Apache License 2.0
from Aloento
@Override
public void initialize(URL location, ResourceBundle resources) {
mainDrawer.setOnDrawerOpening(e -> {
final Transition animation = replacedleBurger.getAnimation();
animation.setRate(1);
animation.play();
});
mainDrawer.setOnDrawerClosing(e -> {
final Transition animation = replacedleBurger.getAnimation();
animation.setRate(-1);
animation.play();
});
replacedleBurgerContainer.setOnMouseClicked(e -> {
if (mainDrawer.isClosed() || mainDrawer.isClosing()) {
mainDrawer.open();
} else {
mainDrawer.close();
}
});
FXMLLoader loader = new FXMLLoader(getClreplaced().getResource("/UI/MainPopup.fxml"));
loader.setController(new InputController());
try {
toolbarPopup = new JFXPopup(loader.load());
} catch (IOException e) {
e.printStackTrace();
}
optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, -12, 15));
Parent Spine = null;
try {
FXMLLoader spineLoader = new FXMLLoader(getClreplaced().getResource("/UI/Spine.fxml"));
Spine = spineLoader.load();
spineController = spineLoader.getController();
} catch (IOException e) {
e.printStackTrace();
}
mainDrawer.setContent(Spine);
Parent Exporter = null;
try {
FXMLLoader exporterLoader = new FXMLLoader(getClreplaced().getResource("/UI/Exporter.fxml"));
Exporter = exporterLoader.load();
} catch (IOException e) {
e.printStackTrace();
}
mainDrawer.setSidePane(Exporter);
}