I have a set of animated image views that are supposed to start out clustered around a bigger image view that contains an image of a balloon, then spread out. To the user, it's supposed to look like that balloon has bursted into pieces.
Here's the code:
However, for some reason, some of the image views are not going the right way. Edit: I don't think the problem lies with the coordinates of any of the image view centers.
Here's the code:
Code:
CGPoint differencePoint = [[self view] convertPoint:[BalloonPieceImageView center] toView:[self stillBalloonImageView]];
CGFloat angle = atan2f(differencePoint.y, differencePoint.x);
CGFloat destinationX = cosf(angle) * radius;
CGFloat destinationY = sinf(angle) * radius;
if (differencePoint.x < 0) {
destinationX = -destinationX;
}
CGPoint destination = [[self view] convertPoint:CGPointMake(destinationX, destinationY) fromView:[self stillBalloonImageView]];
[UIView animateWithDuration:2 animations:^{ [BalloonPieceImageView setCenter:destination]; }];
However, for some reason, some of the image views are not going the right way. Edit: I don't think the problem lies with the coordinates of any of the image view centers.
Last edited: