All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gwt.material.design.addins.client.pathanimator.MaterialPathAnimator Maven / Gradle / Ivy

There is a newer version: 2.8.3
Show newest version
package gwt.material.design.addins.client.pathanimator;

/*
 * #%L
 * GwtMaterial
 * %%
 * Copyright (C) 2015 GwtMaterialDesign
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.client.MaterialDesignBase;

//@formatter:off
/**
 * Custom component that provides meaningfull transition between two elements to show visual continuity.
 *
 * 

XML Namespace Declaration

*
 * {@code
 * xmlns:ma='urn:import:gwt.material.design.addins.client'
 * }
 * 
* *

UiBinder Usage:

*
 * {@code
 * MaterialPathAnimator.animate(Element source, Element target, Runnable callback);
 * }
 * 
* * @author kevzlou7979 * @see Material Path Animator */ //@formatter:on public class MaterialPathAnimator { static { if(MaterialAddins.isDebug()) { MaterialDesignBase.injectJs(MaterialPathAnimatorDebugClientBundle.INSTANCE.pathanimatorDebugJs()); } else { MaterialDesignBase.injectJs(MaterialPathAnimatorClientBundle.INSTANCE.pathanimatorJs()); } } /** * Default animate method using Opacity Transition. */ public static void animate(Element source,final Element target) { Runnable defaultCallback = new Runnable() { @Override public void run() { target.getStyle().setVisibility(Style.Visibility.VISIBLE); target.getStyle().setOpacity(1); } }; animate(source, target, defaultCallback); } /** * Custom path animator method with callback. */ public static native void animate(Element source, Element target, Runnable callback)/*-{ $wnd.jQuery(document).ready(function() { $wnd.cta(source, target, function () { if(callback != null) { [email protected]::run()(); } }); }); }-*/; /** * Default Reverse animate method to return to original state of Source component. */ public static void reverseAnimate(final Element source,final Element target) { Runnable defaultCallback = new Runnable() { @Override public void run() { target.getStyle().setVisibility(Style.Visibility.HIDDEN); target.getStyle().setOpacity(0); } }; reverseAnimate(source,target, defaultCallback); } /** * Reverse animation of the target component to return to original * state of the source component with Custom Callback. */ public static native void reverseAnimate(Element source, Element target, Runnable callback) /*-{ $wnd.jQuery(document).ready(function() { [email protected]::run()(); $wnd.cta(target, source); }); }-*/; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy