ViewPager动画效果
使用此代码来实现 ViewPager 的滑动动画效果仅限于 FusionApp 2 ` ViewPagerId.setPageTransformer(true,PageTransformer{ transformPage=function(view,position) pageWidth=view.getWidth() pageHeight=view.getHeight()
if position<-1 then
view.setAlpha(0)
elseif position<=1 then
scaleFactor=Math.max(min_scale,1-Math.abs(position))
verticalMargin=pageHeight*(1-scaleFactor)/2
horizontalMargin=pageWidth*(1-scaleFactor)/2
if position<0 then
view.setTranslationX(horizontalMargin-verticalMargin/2)
else
view.setTranslationX(-horizontalMargin+verticalMargin/2)
end
view.setScaleX(scaleFactor)
view.setScaleY(scaleFactor)
view.setAlpha(min_alpha+(scaleFactor-min_scale)/(1-min_scale)*(1-min_alpha))
else
view.setAlpha(0)
end
end}) `