A library that contains animations for the viewpager in android.
Options : viewPager.setPageTransformer(true, new DefaultTransformer());
Options :
-
Not specifying Cube Angle:
viewPager.setPageTransformer(true, new CubeOutTransformer());
-
Specifying Cube Angle:
viewPager.setPageTransformer(true, new CubeOutTransformer(CubeOutTransformer.CUBE_ANGLE_60));
Angle options available are CUBE_ANGLE_45 (45°), CUBE_ANGLE_60 (60°) & CUBE_ANGLE_90 (90°).
Options : viewPager.setPageTransformer(true, new ScaleTransformer());
Options :
-
Not specifying movement direction:
viewPager.setPageTransformer(true, new TranslationYTransformer());
-
Specifying movement direction:
viewPager.setPageTransformer(true, new TranslationYTransformer(TOP_TO_BOTTOM));
Movement options available are TOP_TO_BOTTOM & BOTTOM_TO_TOP.
Options : viewPager.setPageTransformer(true, new DepthPageTransformer());
Options : viewPager.setPageTransformer(true, new DrawerTransformer());
Options :
-
Not specifying rotation pivot:
viewPager.setPageTransformer(true, new WindmillTransformer());
-
Specifying pivot point:
viewPager.setPageTransformer(true, new WindmillTransformer(WindmillTransformer.TOP_LEFT_CORNER));
Pivot options available are TOP_LEFT_CORNER & BOTTOM_RIGHT_CORNER.
Options :
- Default, i.e Fade Enabled :
viewPager.setPageTransformer(true, new ZoomOutTransformer());
- Disabling Fade option :
viewPager.setPageTransformer(true, new ZoomOutTransformer(false));
Options : viewPager.setPageTransformer(true, new RaiseFromCenterTransformer());
Options : viewPager.setPageTransformer(true, new RotateAboutTopTransformer());
Options : viewPager.setPageTransformer(true, new RotateAboutBottomTransformer());
Options : viewPager.setPageTransformer(true,new AccordionTransformer());
Select a Random Transformer from the available ones.
Options :viewPager.setPageTransformer(true, new RandomTransformer());
- Add the jitpack maven repository
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency
dependencies {
compile 'com.github.kungfucat:ViewPagerTransformerLibrary:v1.2.0'
}
ViewPager viewPager = findViewById(R.id.viewPager);
ViewPagerAdapter pagerAdapter = new YourViewPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(pagerAdapter);
viewPager.setPageTransformer(true, new CubeOutTransformer());
To get started...
- 🍴 Fork this repo!
- 👯 Clone this repo to your local machine.
- HACK AWAY! 🔨🔨🔨
- 🔃 Create a new pull request using
https://github.com/kungfucat/ViewPagerTransformerLibrary/compare
.
Harsh Bhardwaj (kungfucat)