facebookarchive / pop

An extensible iOS and OS X animation library, useful for physics-based interactions.
Other
19.66k stars 2.88k forks source link

Problem when using beginTime and scale #279

Closed Ricardo1980 closed 9 years ago

Ricardo1980 commented 9 years ago

Hello!

I have a POPSpringAnimation to scale many objects from 0 to 1, nothing special. But I would like they start the animations in random different moments, using: scaleAnimation.beginTime =CACurrentMediaTime()+randomFloat(0, 0.15);;

Problem is that the view should be animated from scale 0 to scale 1, but using beginTime, I see the view in scale 1, after a while, goes to scale 0 and starts the animation till scale 1.

I tried trying to setting up the initial scale to 0, using the view and using the layer, but no luck.

annotationView.layer.transform=CATransform3DMakeScale(0, 0, 1);

annotationView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0, 0);

Any idea or suggestion about how I could fix this? Thanks in advance.

grp commented 9 years ago

Hm, the begin time means that Pop won't animate the property at all until that time. It's as if you didn't add the animation at all until after that time. So you should be able to change the transform just as you would otherwise. (For this property specifically, make sure you don't re-set the layer or view's frame after changing the transform — they can overwrite each other.)

Let me know if that helps.