垂直中心扭曲算法

来源:互联网 发布:哪里可以找到淘宝兼职 编辑:程序博客网 时间:2024/04/30 03:04
private void updateMesh(float fraction) {
float[] src = mOrig;
float[] dst = mVerts;
float startX = mMaxDistance * fraction;
for (int i = 0; i < MESH_COUNT * 2; i += 2) {
float sx = src[i];
float sy = src[i + 1];
if (sx > startX) {
dst[i] = sx;
dst[i + 1] = mHalfHeight;
} else if (sx < startX - mRotateAreaWidth) {
dst[i] = sx;
dst[i + 1] = sy;
} else {
float input = (startX - sx) / mRotateAreaWidth;
float toCenter = sy - mHalfHeight;
dst[i] = sx - toCenter * FloatMath.cos(HALF_PI * input) * .35f;
dst[i + 1] = mHalfHeight + toCenter * FloatMath.sin(HALF_PI * input);
}
}
}
0 0
原创粉丝点击