开发者

How to make Whirlpool like animation in iPhone

I want to show images of user friend's in network as Whirlpool whe开发者_运维百科el like animation. Say For example, In center of view i have an button. if i click on this. the images of friends on network should be displayed like a animation of rotate and expand from the center of that button.

Like in BirdsEye in flex. Here is the Link BirdsEye RAVI'S Explorer

Here is the expample graph Click here click on graph tab.

Please Help Me.


Actually this is quite simple you just need to put a Keyframe Animation to your images views:

//Create a Path Object witch descripes the movement - I didn*t had a better idea to make this whirpool path
UIBezierPath* path;

[path moveToPoint:CGPointMake(0, 0)];

for (NSInteger i=0; i<1000; i++) {

    CGFloat t = i/1000*M_2_PI;

    CGFloat x = t/M_2_PI * sin(t);
    CGFloat y = t/M_2_PI * cos(t);

    [path addLineToPoint:CGPointMake(x, y)];

}

// Apply a transform to the path to fit to your needs
[path applyTransform:CGAffineTransformMakeScale(radius, radius)];
[path applyTransform:CGAffineTransformMakeTranslation(centerx, centery)];


// Now Create the Animation
CAKeyframeAnimation * theAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
// Set the Path
theAnimation.path=path;
// Set the Duration
theAnimation.duration=5.0;

//Add the Animation to the Layer of the Image
[imageView.layer addAnimation:theAnimation forKey:@"Whirlpool"];

If you add the animation to the image i schould move form the center postion in one circle to the positon (centerx,centery+radius)

More reeding you will find here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514


I've seen similar things from a rotational particle system: (like this one). Perhaps you could use or extend a particle system manager for your task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜