forked from daimajia/AndroidImageSlider
-
Notifications
You must be signed in to change notification settings - Fork 0
Transform effect
Joshua Kovach edited this page Jun 14, 2014
·
4 revisions
The transform effect is the visual effect when a slider changes.
There are 15 preset transform effects you can use by calling:
setPresetTransformer(Transformer ts)
If you want to create your own custom transform effect:
Create a class which extends from BaseTransformer
For example:
public class AccordionTransformer extends BaseTransformer {
}
Before you override the default behavior, you have to know how the ViewPager
transformer works. If you are not familiar with it, please read the screen slide animation tutorial.
Override the onTransform(View view,float position)
method:
@Override
protected void onTransform(View view, float position) {
ViewHelper.setPivotX(view, position < 0 ? 0 : view.getWidth());
ViewHelper.setScaleX(view, position < 0 ? 1f + position : 1f - position);
}
NOTICE: Please use ViewHelper
(thanks to NineOldDroid) to make it compatible with Android 2.2+.
Use it.
slider.setPagerTransformer(false,new AccordionTransformer());
You are welcome to contribute and share your amazing indicator, transformer or slider child view animation design. 😄