Java Code Examples for gwt.material.design.client.ui.animate.MaterialAnimation

The following examples show how to use gwt.material.design.client.ui.animate.MaterialAnimation. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gwt-material   Source File: AnimationTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testAnimation() {
    MaterialPanel panel = new MaterialPanel();
    RootPanel.get().add(panel);
    MaterialAnimation animation = new MaterialAnimation();
    animation.delay(0);
    assertEquals(animation.getDelay(), 0);
    animation.infinite(true);
    assertTrue(animation.isInfinite());
    animation.infinite(false);
    assertFalse(animation.isInfinite());
    animation.duration(20);
    assertEquals(animation.getDuration(), 20);
    animation.transition(Transition.FADEIN);
    assertEquals(animation.getTransition(), Transition.FADEIN);
    animation.animate(panel);
    assertEquals(animation.getWidget(), panel);
    // Check Advance Logic
    String WEBKIT_ANIMATION_DURATION = panel.getElement().getStyle().getProperty("WebkitAnimationDuration");
    assertEquals(WEBKIT_ANIMATION_DURATION, animation.getDuration() + "ms");
}
 
Example 2
Source Project: gwt-material-demo   Source File: ApplicationView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setPageTitle(String title, String description, String link, String specification) {
    this.title.setText(title);
    this.description.setText(description);
    this.link = link;
    this.specification = specification;

    if (link.isEmpty()) {
        chipJava.setVisible(false);
        chipXml.setVisible(false);
    } else {
        chipJava.setVisible(true);
        chipXml.setVisible(true);
    }

    if (specification.isEmpty()) {
        chipSpecification.setVisible(false);
    } else {
        chipSpecification.setVisible(true);
    }

    new MaterialAnimation().transition(Transition.BOUNCEINLEFT).animate(this.title);
    new MaterialAnimation().transition(Transition.BOUNCEINLEFT).animate(this.description);
}
 
Example 3
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("btnFAB")
void onFAB(ClickEvent e){
    // Execute the opening callback once the fab is clicked
    MaterialPathAnimator.animate(btnFAB.getElement(), musicPanel.getElement(), () -> {
        // Hide the fab with zoom out animation
        new MaterialAnimation().transition(Transition.ZOOMOUT).animate(btnFAB);
        btnFAB.setVisibility(Style.Visibility.HIDDEN);
        btnFAB.setOpacity(0);

        // Setting the visibility of the music panel
        musicPanel.setVisibility(Style.Visibility.VISIBLE);
        musicPanel.setOpacity(1);

        // Setting the music label with Bounce up animation
        lblMusic.setText("Pharell Williams / Love Yourself to Dance");
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblMusic);

        // Setting the image of the artist
        imgMusic.setUrl("http://thatgrapejuice.net/wp-content/uploads/2013/08/pharrell-williams-that-grape-juice.png");
    });
}
 
Example 4
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("btnPause")
void onPause(ClickEvent e){
    // Execute the close callback animation
    MaterialPathAnimator.reverseAnimate(btnFAB.getElement(), musicPanel.getElement(), () -> {
        // Setting the visibility of the FAB for reverse animation
        new MaterialAnimation().transition(Transition.ZOOMIN).animate(btnFAB);
        btnFAB.setVisibility(Style.Visibility.VISIBLE);
        btnFAB.setOpacity(1);

        // Hide the music panel once the pause button is clicked
        musicPanel.setVisibility(Style.Visibility.HIDDEN);
        musicPanel.setOpacity(0);

        // Setting the previous music label with Bounce down animation
        lblMusic.setText("Lady Gaga / Telephone");
        new MaterialAnimation().transition(Transition.BOUNCEINDOWN).animate(lblMusic);

        // Setting the image of the artist
        imgMusic.setUrl("https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRi9lfCkLutb7ugJlIjn84qWNoiICopC-Vyx7QQJRHF5E7GlqFG");
    });
}
 
Example 5
@Override
public void animateNext() {
    MaterialStep currentStep = stepper.getCurrentStep();
    MaterialStep nextStep = stepper.getStep(currentStep.getStep() + 1);
    if (currentStep != null && nextStep != null) {

        if (enableTransition && stepper.getAxis() == Axis.HORIZONTAL) {
            currentStep.getDivBody().setOverflow(Style.Overflow.HIDDEN);
            new MaterialAnimation().transition(nextOutTransition).animate(currentStep.getConBody(), () -> {
                currentStep.setActive(false);
                currentStep.getDivBody().setOverflow(Style.Overflow.AUTO);
            });

            nextStep.setActive(true);
            new MaterialAnimation().transition(nextInTransition).animate(nextStep.getConBody());
        } else {
            currentStep.setActive(false);
            nextStep.setActive(true);
        }
    }
}
 
Example 6
@Override
public void animatePrevious() {
    MaterialStep currentStep = stepper.getCurrentStep();
    MaterialStep previousStep = stepper.getStep(currentStep.getStep() - 1);
    if (currentStep != null && previousStep != null) {
        if (enableTransition && stepper.getAxis() == Axis.HORIZONTAL) {
            currentStep.getDivBody().setOverflow(Style.Overflow.HIDDEN);
            new MaterialAnimation().transition(previousOutTransition).animate(currentStep.getConBody(), () -> {
                currentStep.setActive(false);
                currentStep.getDivBody().setOverflow(Style.Overflow.AUTO);
            });

            previousStep.setActive(true);
            previousStep.getDivBody().setOverflow(Style.Overflow.HIDDEN);
            new MaterialAnimation().transition(previousInTransition).animate(previousStep.getConBody(), () -> {
                previousStep.getDivBody().setOverflow(Style.Overflow.AUTO);
            });
        } else {
            currentStep.setActive(false);
            previousStep.setActive(true);
        }
    }
}
 
Example 7
Source Project: gwt-material-demo   Source File: CoreAnimationsView.java    License: Apache License 2.0 5 votes vote down vote up
private void animate() {
    String value = lstAnimations.getSelectedValue();
    Transition transition = Transition.fromStyleName(value);
    MaterialAnimation animation = new MaterialAnimation();
    animation.setTransition(transition);
    animation.setDelay(0);
    animation.setDuration(1000);
    animation.setInfinite(false);
    animation.animate(card);
}
 
Example 8
Source Project: gwt-material-demo   Source File: CoreAnimationsView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnAnimateInfinite")
void onAnimateInfinite(ClickEvent e) {
    infiniteAnimation = new MaterialAnimation();
    infiniteAnimation.setDelay(0);
    infiniteAnimation.setTransition(Transition.PULSE);
    infiniteAnimation.setDuration(1000);
    infiniteAnimation.setInfinite(true);
    infiniteAnimation.animate(iconHeart);
}
 
Example 9
Source Project: gwt-material-demo   Source File: CoreAnimationsView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnAnimateCallback")
void onCallback(ClickEvent e) {
    MaterialAnimation animation = new MaterialAnimation();
    animation.setDelay(0);
    animation.setDuration(1000);
    animation.transition(Transition.FLIPINX);
    animation.animate(iconCallback, () -> {
        MaterialToast.fireToast("Animation is finished");
    });
}
 
Example 10
Source Project: gwt-material-demo   Source File: ScrollFireView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
ScrollFireView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    MaterialScrollfire.apply(panel.getElement(), () -> {
        MaterialToast.fireToast("Toasted");
    });
    MaterialScrollfire.apply(listContainer.getElement(), () -> new MaterialAnimation().transition(Transition.SHOW_STAGGERED_LIST).animate(listContainer));
    MaterialScrollfire.apply(image.getElement(), () -> new MaterialAnimation().transition(Transition.FADE_IN_IMAGE).animate(image));

}
 
Example 11
Source Project: gwt-material-addins   Source File: WalkthroughItem.java    License: Apache License 2.0 5 votes vote down vote up
public void animate() {
    if (!animated) {
        new MaterialAnimation().transition(Transition.FADEIN).delay(0).duration(600).animate(image, () -> {
            image.setOpacity(1);
            titleLabel.setOpacity(1);
            descriptionLabel.setOpacity(1);
            new MaterialAnimation().transition(Transition.SLIDEINRIGHT).animate(titleLabel);
            new MaterialAnimation().transition(Transition.SLIDEINRIGHT).animate(descriptionLabel);
        });

        animated = true;
    }
}
 
Example 12
Source Project: gwt-material-addins   Source File: AppLoadingState.java    License: Apache License 2.0 5 votes vote down vote up
public void reset(Widget target, int delay) {
    new MaterialAnimation().transition(Transition.BOUNCEOUTDOWN).delay(delay).animate(this, () -> {
        target.setVisible(true);
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(target, () -> {
            RootPanel.get().getElement().getStyle().clearOverflow();
            target.setVisible(true);
        });
        setVisible(false);
    });
}
 
Example 13
Source Project: gwt-material-addins   Source File: LoadingStatePanel.java    License: Apache License 2.0 5 votes vote down vote up
public void setState(State state, String title, String description) {
    this.state = state;
    setTitle(title);
    setDescription(description);
    setVisible(true);
    if (isAnimation()) {
        new MaterialAnimation().transition(Transition.BOUNCEIN).animate(icon);
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblTitle);
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblDescription);
    }
    if (state == State.LOADING) {
        icon.setIconType(IconType.LOOP);
        icon.setBackgroundColor(Color.WHITE);
        icon.setIconColor(Color.BLACK);
        LoadingEvent.fire(this);
        loader.show();

    } else if (state == State.SUCCESS) {
        loader.hide();
        icon.setIconType(IconType.CHECK);
        icon.setBackgroundColor(Color.BLUE);
        icon.setIconColor(Color.WHITE);

        SuccessEvent.fire(this);
    } else if (state == State.ERROR) {
        loader.hide();
        icon.setIconType(IconType.ERROR);
        icon.setBackgroundColor(Color.RED);
        icon.setIconColor(Color.WHITE);

        ErrorEvent.fire(this);
    }
}
 
Example 14
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: Apache License 2.0 4 votes vote down vote up
public PathAnimatorShowcase() {
    initWidget(uiBinder.createAndBindUi(this));
    new MaterialAnimation().transition(Transition.BOUNCEINDOWN).animate(btnFAB);
}
 
Example 15
@UiHandler("btnCloseGrid")
void onCloseGrid(ClickEvent e) {
    MaterialAnimation gridAnimation = new MaterialAnimation();
    gridAnimation.setTransition(Transition.CLOSE_GRID);
    gridAnimation.animate(gridPanel);
}
 
Example 16
@UiHandler("btnShowGrid")
void onShowGrid(ClickEvent e) {
    MaterialAnimation gridAnimation = new MaterialAnimation();
    gridAnimation.setTransition(Transition.SHOW_GRID);
    gridAnimation.animate(gridPanel);
}
 
Example 17
@UiHandler("btnStaggered")
void onStaggered(ClickEvent e) {
    MaterialAnimation gridAnimation = new MaterialAnimation();
    gridAnimation.setTransition(Transition.SHOW_STAGGERED_LIST);
    gridAnimation.animate(listContainer);
}
 
Example 18
@UiHandler("btnFade")
void onFade(ClickEvent e) {
    MaterialAnimation gridAnimation = new MaterialAnimation();
    gridAnimation.setTransition(Transition.FADE_IN_IMAGE);
    gridAnimation.animate(image);
}
 
Example 19
Source Project: gwt-material-demo   Source File: CardsView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnShow")
void onShow(ClickEvent e) {
    new MaterialAnimation().transition(Transition.SHOW_GRID).animate(rowCards);
}
 
Example 20
Source Project: gwt-material-addins   Source File: MaterialWindow.java    License: Apache License 2.0 4 votes vote down vote up
public void setOpenAnimation(final MaterialAnimation openAnimation) {
    this.openAnimation = openAnimation;
}
 
Example 21
Source Project: gwt-material-addins   Source File: MaterialWindow.java    License: Apache License 2.0 4 votes vote down vote up
public void setCloseAnimation(final MaterialAnimation closeAnimation) {
    this.closeAnimation = closeAnimation;
}