我有2张卡都旋转了23度,我想将它们并排分开,如下图所示。目前我正在使用以下代码根据它们的X轴进行补间,但如果卡片处于23度或90度,这种方法效果不佳。如何使用Tween引擎将它们并排排列?
Tween.to( card1, CardAccessor.POS_XY, 3f)
.target( card1.getX()-75, card1.getY() )
.ease(TweenEquations.easeInOutQuad)
.start( tweenManager );
Tween.to( card2, CardAccessor.POS_XY, 3f)
.target( card2.getX()+75, card2.getY() )
.ease(TweenEquations.easeInOutQuad)
.start( tweenManager );
我的CardAccessor类目前只能像这样设置和获取XY pos:
public class CardAccessor implements TweenAccessor<Card> {
public static final int POS_XY = 1;
@Override
public int getValues( Card target, int tweenType, float[] returnValues) {
switch (tweenType) {
case POS_XY:
returnValues[0] = target.getX();
returnValues[1] = target.getY();
return 2;
}
}
@Override
public void setValues( Card target, int tweenType, float[] newValues) {
switch (tweenType) {
case POS_XY:
target.setPosition(newValues[0], newValues[1]);
break;
}
}
答案 0 :(得分:1)
xr = x * sin(23);
yr = x * cos(23);