Skip to content
Weiping Huang edited this page Apr 5, 2017 · 4 revisions

In Basic Usage, as introduced, ease are able to used to make animation cute and vividness. You can use ease in PageAnimation builders with the following types:

For the enums corresponding to the above eases, please check the Ease.Class. But, what if I want to use the other ease? Ease, in fact, as implement in WoWoViewPager, is a kind of TimeInterpolator. So, you can use custom TimeInterpolator in builders of PageAnimation by:

viewAnimation.add(WoWoScaleAnimation.builder()
        .page(0)
        .fromXY(1).toXY(0.5)
        .interpolator(new TimeInterpolator() {
            @Override
            public float getInterpolation(float input) {
                return input;
            }
        })
        .build());

And, just like ease in ViewAnimation and WoWoViewPager, you can set interpolator for all PageAnimations in ViewAnimations :

// Set TimeInterpolator for all page animations.
viewAnimation.setTimeInterpolator(new TimeInterpolator() {
    @Override
    public float getInterpolation(float input) {
        return input;
    }
});
// Set TimeInterpolator for all page animations at a certain page.
viewAnimation.setTimeInterpolator(new TimeInterpolator() {
    @Override
    public float getInterpolation(float input) {
        return input;
    }
}, 2);

Or set interpolator for all ViewAnimations in WoWoViewPager:

// Set TimeInterpolator for all page animations in all view animations.
wowo.setTimeInterpolator(new TimeInterpolator() {
    @Override
    public float getInterpolation(float input) {
        return input;
    }
});
// Set TimeInterpolator for all page animations at a certain page in all view animations.
wowo.setTimeInterpolator(new TimeInterpolator() {
    @Override
    public float getInterpolation(float input) {
        return input;
    }
}, 2);