199 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
XPages Tip: Adding a Bootstrap Class to All Labels via the Theme (Redux)
Wed, Jul 20th 2016 15
XPages Tip: Overriding, Concatenating, and Conditionally Adding Control Properties via a Theme
Wed, Jul 20th 2016 7
XPages Tip: Displaying Bootstrap Applications Properly on Mobile Devices
Tue, May 31st 2016 11
Efficiently Keeping an XPages Session Alive with JSON RPC
Wed, May 25th 2016 8
Browser Session Lifespan – Idle Session Timeout vs LTPA Token Expiration
Tue, May 24th 2016 7
XPages Tip: Passing an Array to a Custom Control Property
Tue, Apr 12th 2016 8
XPages Tip: Beware Server-Side code in Multiple onClientLoad Events
Thu, Apr 7th 2016 8
Top 10
XPages Tip: Adding a Bootstrap Class to All Labels via the Theme (Redux)
Wed, Jul 20th 2016 15
Passing Parameters to SSJS from a Client-side partialRefreshGet()
Mon, Jul 14th 2014 14
Gridx in XPages – 15: Adding QuickFilter for Full-Text Searching
Tue, Dec 9th 2014 13
Adding Event Handlers to Font Awesome Icons in XPages
Wed, Apr 9th 2014 12
Dojo in XPages – 20: Handling Successful or Failed AJAX Requests
Wed, Apr 23rd 2014 12
Dojo in XPages – 7: Selecting DOM Elements with dojo.query
Mon, Feb 24th 2014 11
Dojo in XPages – 26: Combining Badge with LightboxNano
Wed, May 21st 2014 11
XPages Tip: Displaying Bootstrap Applications Properly on Mobile Devices
Tue, May 31st 2016 11
Dojo in XPages – 6: Selecting a DOM Element with dojo.byId()
Thu, Feb 20th 2014 10
Dojo in XPages – 21: Displaying Images with a ThumbnailPicker
Tue, May 6th 2014 10


Dojo in XPages – 15: Modifying the Rate of Animation with Easing Functions
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
Brad Balassaitis    

In the last few posts, we’ve looked at dojo code to perform pre-defined animations and custom animations. By default, the animations progress in a linear fashion, but the rate of animation can be changed. In this post, we’ll take a look at the easing functions that are available to modify animations.

Dojo in XPages Series

Dojo in XPages — All Blog Posts

Built-In Easing Functions

The easing property of an animation defines the rate of the animation.

You can write your own function to use, but there are 31 built-in functions already available to save you some time.

The default is linear – it performs the transition evenly throughout. The other methods are mathematical calculations that change the rate of the transition at the beginning or end (or both).

Easing Function Effect on Transition
linear No effect — even throughout
quadIn, quadOut, quadInOut rate by power of 2
cubicIn, cubicOut, cubicInOut rate by power of 3
quartIn, quartOut, quartInOut rate by power of 4
quintIn, quintOut, quintInOut rate by power of 5
sineIn, sineOut, sineInOut rate by sine function over time
expoIn, expoOut, expoInOut exponential effect
circIn, circOut, circInOut circular effect
backIn, backOut, backInOut start away from target, then move toward it
elasticIn, elasticOut, elasticInOut back and forth, then toward target
bounceIn, bounceOut, bounceInOut bounce near the beginning or end

Naming Convention

The functions are all named consistently. They specify the affect and at which end(s) the effect will be applied.

  • The *In functions start slowly and then speed up toward the end
  • The *Out functions start faster and end slowly (the opposite of the *In functions)
  • The *InOut functions start slowly, speed up, then end slowly

Dojo Modules to Include

The easing functions are part of the dojo.fx.easing module, so you’ll need to include it on your page in order to use them. (This is in addition to including dojo.fx if you’re using a function in that module.)

Example

Here’s an example that will take a div called myDiv on the page and move it, using the bounceIn easing function:

dojo.fx.slideTo({
  node:"myDiv",
  top: 100,
  left: 400,
  easing: dojo.fx.easing.bounceIn,
  duration: 3000
}).play();

More Examples

There’s a good demo already set up in the Dojo documentation that allows you to test each one of these easing functions.

https://dojotoolkit.org/reference-guide/1.8/dojo/fx/easing.html#examples

Just click the Play button and you can choose a function to try. Test them out and use whatever suits your needs best




---------------------
http://xcellerant.net/2014/03/20/dojo-in-xpages-15-modifying-the-rate-of-animation-with-easing-functions/
Mar 20, 2014
3 hits



Recent Blog Posts




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition