jQuery/JS Common - Object Structures - animationConfig
complete
The animated element. It is an HTML Element or a jQuery Element when you use jQuery.
easing
DevExtreme supports predefined jQuery easing ("linear" and "swing") and CSS transition timing functions ("linear", "ease", "ease-in", "ease-out", "ease-in-out", "cubic-besier(0,1,1,0)", etc.). For more information on CSS transition timing functions, see CSS3 transition-timing-function Property. You can also register a custom easing function using jQuery and pass its name to the easing property.
$.easing.customEasing = function(t, millisecondsSince, startValue, endValue, totalDuration) { if (t < 0.5) { return t * 4; } else { return -2 * t + 3; } }; var animationOptions = { show: { duration: 2000, type: "slide", from: { left: -300 }, easing: "customEasing" } };
from
The values that this property accepts depend on the specified animation type. The following list illustrates the dependency:
fade
from accepts a number from 0 to 1 and specifies the UI component's opacity. 0 makes the UI component completely transparent; 1 makes it opaque.JavaScriptfrom: 0.1
pop
from accepts an object with the opacity and scale fields; each takes a value from 0 to 1.
Opacity is specified the same way as in the fade animation type. A scale of 0 hides the UI component; a scale of 1 displays the UI component in its default size.JavaScriptfrom: { scale: 0.2, opacity: 0 }
slide
from accepts an object with the opacity field and fields that configure the UI component's position.
Opacity is specified the same way as in the fade animation type. The UI component's position can be set using the position field that accepts the position configuration object. This approach covers all cases. You can also use the top and left fields, which are shortcuts for positioning the UI component relative to its parent element or shifting the UI component from its default position.JavaScriptfrom: { opacity: 0.5, top: 100 // places the UI component 100px below the parent element /* top: "+=100" // shifts the UI component 100px below its default position */ } ==== or ==== from: { opacity: 0.5, position: { my: 'top', at: 'top', of: "#targetElement" } // places the top of the UI component at the top of the "targetElement" }
css
from accepts a string specifying a CSS class or several CSS classes separated by a comma.JavaScriptCSSfrom: "fade-out-text, fade-out-visibility"
.fade-out-visibility { opacity: 0; } .fade-out-text { font-size: 5pt; }
staggerDelay
Specify this property for a staggered animation - when several elements are animated one after another with a delay. Note that this type of animation can be performed only by the TransitionExecutor.
start
The animated element. It is an HTML Element or a jQuery Element when you use jQuery.
to
The values that this property accepts depend on the specified animation type. The following list illustrates the dependency:
fade
to accepts a number from 0 to 1 and specifies the UI component's opacity. 0 makes the UI component completely transparent; 1 makes it opaque.JavaScriptto: 1
pop
to accepts an object with the opacity and scale fields; each takes a value from 0 to 1.
Opacity is specified the same way as in the fade animation type. A scale of 0 hides the UI component; a scale of 1 displays the UI component in its default size.JavaScriptto: { scale: 1, opacity: 1 }
slide
to accepts an object with the opacity field and fields that configure the UI component's position.
Opacity is specified the same way as in the fade animation type. The UI component's position can be set using the position field that accepts the position configuration object. This approach covers all cases. You can also use the top and left fields, which are shortcuts for positioning the UI component relative to its parent element or shifting the UI component from its default position.JavaScriptto: { opacity: 1, top: 10 // places the UI component 10px below the parent element /* top: "+=10" // shifts the UI component 10px below its default position */ } ==== or ==== to: { opacity: 1, position: { my: 'top', at: 'bottom', of: "#targetElement" } // places the top of the UI component at the bottom of the "targetElement" }
css
to accepts a string specifying a CSS class or several CSS classes separated by a comma.JavaScriptCSSto: "fade-out-active-text, fade-out-active-visibility"
.fade-out-active-visibility { opacity: 1; } .fade-out-active-text { font-size: 15pt; }
type
The value of the property affects the UI component's initial and target states, which are specified using the from and to properties.
The type properties can take on the following values.
"fade"
Animates element opacity."fadeIn"
Animates element opacity from 0 to 1."fadeOut"
Animates element opacity from 1 to 0."pop"
Animates element scale."slide"
Animates element position."slideIn"
Moves the element from outside the screen to the target position."slideOut"
Moves the element from the initial position to outside the screen."css"
Applies the CSS style(s) specified by the from property and then applies the style(s) specified by the to property. The class that is applied at the animation end is appended to the class applied at the animation start. This allows not to duplicate the CSS properties that are common for the animation start and end.Here is an example of css animation:
JavaScriptCSSDX.fx.animate(element, { type: 'css', from: 'fade-out', to: 'fade-out-active', duration: 1000 });
.fade-out { opacity: 1; } .fade-out-active { opacity: 0; }
If the type property is set to "slideIn" or "slideOut", specify the sliding direction using the direction property.