如题
我现在有一个正方形 起始点是它的中心点 末尾点是我收拖拽结束之后的那个点 这两点构成一条直线 如何让这个正方形的中心点始终沿着这条直线(延长线)运动呢?
ringa_lee2017-04-17 18:00:45
Work out the position of the point to the edge of the screen from the start and end points, then move your square from the start point to the edge point of the screen.
If you need to move it out of the screen, just move the edge point a little outside the screen.
迷茫2017-04-17 18:00:45
If you want such an animation, just specify the beginning and end positions directly, no need to worry about the intermediate process
巴扎黑2017-04-17 18:00:45
pseudocode
[UIView animateDuration:1 animations:{
view.center = targetPoint;
}];
PHP中文网2017-04-17 18:00:45
This is a small demo I wrote. Can you understand it? https://github.com/KarmaChen/TestViewAnimation.git