我知道如何通过移动/调整UIView来实现基本的动画。然而,下面两个动画似乎有点复杂。
1)想象一个汽车游戏,当你按下踏板按钮时,速度表旋转。如何制作那种条形“填充”成圆形的动画?
2)第二个动画更容易描述。如何做动画的数字增加,在那里的数字滑落和新的数字出现在顶部类似于老虎机。
发布于 2009-06-09 16:16:25
对于你的第一个问题,我认为CGAffineTransform是最好的选择。用这个,我想像这样的东西可以起作用:
// BarView is a derived class from UIView that knows how to draw a "bar"
BarView view[NumBars];
for(int i = 0; i < NumBars; i++)
{
// First place the view at the center of the instrument
[view[i] setCenter:CGPointMake(InstrumentX, InstrumentY)];
// Now translate the view InstrumentWidth units on the positive X-Axis
CGAffineTransform translate = CGAffineTransformMakeTranslation(InstrumentWidth, 0);
// Rotate the view about the origin by an angle related to which "bar" this is
CGAffineTransform rotate = CGAffineTransformMakeRotation(i*AngleBetweenBars);
// create a transform matrix from the translation and rotation matrices and apply it to the view
[view[i] setTransform:CGAffineTransformConcat(translate, rotate)];
}https://stackoverflow.com/questions/970939
复制相似问题