Back to project page AndroidImageSlider.
The source code is released under:
MIT License
If you think the Android project AndroidImageSlider listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.daimajia.slider.library.Transformers; /*ww w . j a v a 2s . c o m*/ import android.view.View; import com.nineoldandroids.view.ViewHelper; /** * Created by realandylawton on 11/22/13. */ public class FadeTransformer extends BaseTransformer { @Override protected void onTransform(View view, float position) { // Page is not an immediate sibling, just make transparent if(position < -1 || position > 1) { ViewHelper.setAlpha(view,0.6f); } // Page is sibling to left or right else if (position <= 0 || position <= 1) { // Calculate alpha. Position is decimal in [-1,0] or [0,1] float alpha = (position <= 0) ? position + 1 : 1 - position; ViewHelper.setAlpha(view,alpha); } // Page is active, make fully visible else if (position == 0) { ViewHelper.setAlpha(view,1); } } }