@Size(2)
private float[] calculateFinalTranslationPx(View child, @Size(2) float[] translations) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
int xSign = translations[0] > 0 ? 1 : -1;
int ySign = translations[1] > 0 ? 1 : -1;
float translationX =
xSign * lp.offsetPx * interpolator.getInterpolation(Math.abs(translations[0])) * scaleX;
float translationY =
ySign * lp.offsetPx * interpolator.getInterpolation(Math.abs(translations[1])) * scaleY;
return new float[]{translationX, translationY};
}
ParallaxLayerLayout.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:CheckIn
作者:
评论列表
文章目录