Example usage for com.google.gwt.animation.client Animation run

List of usage examples for com.google.gwt.animation.client Animation run

Introduction

In this page you can find the example usage for com.google.gwt.animation.client Animation run.

Prototype

public void run(int duration, double startTime) 

Source Link

Document

Run this animation at the given startTime.

Usage

From source file:org.vectomatic.svg.edu.client.dots.DotsMain.java

License:Open Source License

@UiHandler("testButton")
public void transition(ClickEvent event) {
    pictureAlpha2.setValue(0f);/*from ww  w.j  a  v a  2 s .c o  m*/
    gaussianBlur.setStdDeviation(10f, 10f);
    polyline.setClassNameBaseVal(css.lineVisible());
    pictureGroup.getStyle().setSVGProperty(SVGConstants.SVG_FILTER_ATTRIBUTE,
            DOMHelper.toUrl(ID_TRANSITION_FILTER));
    if (points.getNumberOfItems() > 0) {
        points.appendItem(points.getItem(0).assignTo(rootSvg.createSVGPoint()));
    }
    Animation transition = new Animation() {
        @Override
        protected void onUpdate(double progress) {
            pictureAlpha2.setValue((float) progress);
            float stdDev = 10f * (1f - (float) progress);
            gaussianBlur.setStdDeviation(stdDev, stdDev);
            dotAlpha.setValue(1f - (float) progress);
        }

        @Override
        protected void onComplete() {
            if (getMode() == Mode.DESIGN) {
                polyline.setClassNameBaseVal(
                        showLineCheck.getValue() ? css.lineVisible() : css.lineInvisible());
                pictureGroup.getStyle().setSVGProperty(SVGConstants.SVG_FILTER_ATTRIBUTE,
                        DOMHelper.toUrl(ID_ALPHA1_FILTER));
                dotAlpha.setValue(1f);
                if (points.getNumberOfItems() > 0) {
                    points.removeItem(points.getNumberOfItems() - 1);
                }
            } else {
                pictureAlpha2.setValue(1f);
                gaussianBlur.setStdDeviation(0.00001f, 0.00001f);
                dotAlpha.setValue(0f);
            }
        }
    };
    pictureGroup.getStyle().setVisibility(Visibility.VISIBLE);
    transition.run(2000, Duration.currentTimeMillis() + 1000);
}

From source file:org.vectomatic.svg.edu.client.Main.java

License:Open Source License

@UiHandler("testButton")
public void transition(ClickEvent event) {
    pictureAlpha2.setValue(0f);//from   w ww.jav a 2  s  .co  m
    gaussianBlur.setStdDeviation(10f, 10f);
    polyline.setClassNameBaseVal(STYLE_LINE1);
    pictureSvg.getStyle().setSVGProperty(SVGConstants.SVG_FILTER_ATTRIBUTE,
            DOMHelper.toUrl(ID_TRANSITION_FILTER));
    if (points.getNumberOfItems() > 0) {
        points.appendItem(points.getItem(0).assignTo(dotSvg.createSVGPoint()));
    }
    Animation transition = new Animation() {
        @Override
        protected void onUpdate(double progress) {
            pictureAlpha2.setValue((float) progress);
            float stdDev = 10f * (1f - (float) progress);
            gaussianBlur.setStdDeviation(stdDev, stdDev);
            dotAlpha.setValue(1f - (float) progress);
        }

        @Override
        protected void onComplete() {
            if (mode == Mode.DESIGN) {
                polyline.setClassNameBaseVal(showLineCheck.getValue() ? STYLE_LINE1 : STYLE_LINE2);
                pictureSvg.getStyle().setSVGProperty(SVGConstants.SVG_FILTER_ATTRIBUTE,
                        DOMHelper.toUrl(ID_ALPHA1_FILTER));
                dotAlpha.setValue(1f);
                if (points.getNumberOfItems() > 0) {
                    points.removeItem(points.getNumberOfItems() - 1);
                }
            } else {
                pictureAlpha2.setValue(1f);
                gaussianBlur.setStdDeviation(0.00001f, 0.00001f);
                dotAlpha.setValue(0f);
            }
        }
    };
    pictureSvg.getStyle().setVisibility(Visibility.VISIBLE);
    transition.run(2000, Duration.currentTimeMillis() + 1000);
}