iPhone animation based on input values (touches) not time

后端 未结 5 1383
粉色の甜心
粉色の甜心 2020-12-28 20:30

For an animation effect perfectly suited to an animation group approach as shown in Brad Larson\'s answer here, I need the animation to proceed according to inputs. Specific

5条回答
  •  隐瞒了意图╮
    2020-12-28 20:52

    I would make a velocity calculation in touches moved, and add it to a local variable that a block can mutate via a timer.

    in other words, in touches moved make a velocity calculation bearing in mind the direction of a previous velocity. In touches ended, fire a block that translates the 'marble' decaying the velocity as you disire. If the user moves the marble again, modify the local variable, this will in turn speed up the animation of the marble or slow it down/change direction depending on on the direction of the touch.

提交回复
热议问题