我需要一些有关 CarouselExample 的帮助,可以使用此链接签出。我想让它垂直旋转。我在名为 getMatrixForCard 的 .rs 文件中找到了一个方法,其中完成了卡片矩阵的转换。这是方法:
static bool getMatrixForCard(rs_matrix4x4* matrix, int i, bool enableSway, bool
enableCardMatrix)
{
float theta = cardPosition(i);
float swayAngle = getSwayAngleForVelocity(velocity, enableSway);
rsMatrixRotate(matrix, degrees(theta), 0, 1, 0);
rsMatrixTranslate(matrix, radius, getVerticalOffsetForCard(i), 0);
/* rsMatrixTranslate(matrix, 0, radius, 0);*/
float rotation = cardRotation + swayAngle;
if (!cardsFaceTangent) {
rotation -= theta;
}
rsMatrixRotate(matrix, degrees(rotation), 0, 1, 0);
bool stillAnimating = false;
if (i == animatedSelection) {
float3 scale;
stillAnimating = getAnimatedScaleForSelected(&scale);
rsMatrixScale(matrix, scale.x, scale.y, scale.z);
}
// TODO(jshuma): Instead of ignoring this matrix for the detail texture, use card
bounding box
if (enableCardMatrix) {
rsMatrixLoadMultiply(matrix, matrix, &cards[i].matrix);
}
return stillAnimating;
}
所以我猜想从这条线用 y 改变 x 的值会使其工作。
rsMatrixTranslate(matrix, radius, getVerticalOffsetForCard(i), 0);
但事实并非如此。如果有人检查了这个例子并且知道如何帮助我并使旋转木马垂直,我将不胜感激。