objective-c - ios 如何朝一条直线方向移动
大家讲道理
大家讲道理 2017-04-17 17:58:45
0
4
380

如题
我现在有一个正方形 起始点是它的中心点 末尾点是我收拖拽结束之后的那个点 这两点构成一条直线 如何让这个正方形的中心点始终沿着这条直线(延长线)运动呢?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
左手右手慢动作

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.

迷茫

If you want such an animation, just specify the beginning and end positions directly, no need to worry about the intermediate process

巴扎黑

pseudocode

[UIView animateDuration:1 animations:{
    view.center = targetPoint;
}];
Ty80

This is a small demo I wrote. Can you understand it? https://github.com/KarmaChen/TestViewAnimation.git

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template