Skip to content

Predefined Animations

Ivan Škorić edited this page Mar 8, 2019 · 4 revisions

One of the main powers of VanGogh library is that it provides predefined animations that are commonly used so you can just grab them instead of defining you own. Keep in mind that new ones are constantly being added.

Predefined animations can be found in various classes inside the com.pspdfkit.vangogh.api package. For example: FadeAnimations, ScaleAnimations, RotateAnimations, etc. Each of these classes contains static methods for animating views.

For example, if you use FadeAnimations class you can control fade animations on your views straight away:

import static com.pspdfkit.labs.vangogh.api.FadeAnimations.*;

// Fades in view1.
fadeIn(view1).subscribe();

// Fades out view2 in 300ms with LinearInterpolator.
fadeOut(view2, 300L, new LinearInterpolator()).subscribe();

Default values

By default (if not defined otherwise) predefined animations will be executed with duration the same as if you would define them in Android platform (300ms for phones) and by using the AccelerateDecelerate interpolator. All of the methods also allow you to specify those two values by yourself as well.

Quickly and slowly

If you look into the classes with predefined methods, you'll notice there are variations of methods having Quickly or Slowly in their names, such as fadeInQuickly(), fadeOutSlowly(), etc.

  • Default duration for methods with Slowly in the name is 3 times the default value.

  • Default duration for methods with Quickly in the name is 60% of the default value.