Thursday 15 March 2012

iphone - How to animate CAShapeLayer path and fillColor -


How to alert the passport path and fillcolor?

How to alert the stroke the way the path is being pulled? And how to animate fillcolor?

To animate the path

  // CAShapeLayer myShapeLayer Strokecolor = setup [[UIColor blueColor] CGColor]; MyShapeLayer.lineWidth = 5; MyShapeLayer.fillColor = [[UIColor yellowColor] CGColor]; // Display it! [Self.view.layer addSublayer: myShapeLayer]; // Animate path CABasicAnimation * PathAnimation = [CABasic animation with animation: @ "strokeend"]; PathAnimation.duration = 1.5f; PathAnimation.fromValue = [Flow with NSNumber Number: 0.0F]; PathAnimation.toValue = [NSNumber Number explosion: 1.0F]; PathAnimation.repeatCount = 10; PathAnimation.autoreverses = Yes; [MyShapeLayer addAnimation: pathAnimation forKey: @ "Strokeend"]; // Cheat color filler CABasic animation * Fillation animation = [CABasic animation with animation: @ "Phil Collar"]; FillColorAnimation.duration = 1.5f; FillColorAnimation.fromValue = (id) [[UIColor clearColor] CGColor]; FillcolorAnimation.toValue = (id) [[UIColor yellowColor] CGColor]; FillColorAnimation.repeatCount = 10; FillcolorAnimation.autoreverses = yes; [MyShapeLayer addAnimation: fillColorAnimation forKey: @ "fillcolor"];   

I hope this helps :)

No comments:

Post a Comment