Tuesday, September 21, 2010

Simple animation of snowFlake

// put the flake in our main view

[self.view addSubview:flakeView];

[UIView beginAnimations:nil context:flakeView];
 
// set up how fast the flake will fall
 
[UIView setAnimationDuration:4 * speed];
 
// set the postion where flake will move to
 

flakeView.frame = CGRectMake(endX, 500.0,16, 16);
 
// set a stop callback so we can cleanup the flake when it reaches the
// end of its animation
 
[UIView setAnimationDidStopSelector:@selector(onAnimationComplete:finished:context:)];
 
[UIView setAnimationDelegate:self];
 
[UIView commitAnimations];

No comments:

Post a Comment