开发者

How to animate a pulsating blue dot with Core Animation?

开发者 https://www.devze.com 2023-03-30 00:52 出处:网络
I am a Core Animation newbie and I want to animate a pulsating blue dot very similar to what the Maps application does with the GPS position.

I am a Core Animation newbie and I want to animate a pulsating blue dot very similar to what the Maps application does with the GPS position.

This is not in a map, and this doesn't use Map Kit. It's inside one of my own views (a UIImageView subclass actually), itself inside a UIScrollView.

I am just starting and I am hopeful for suggestions, best practices, perhaps sample code, to speed up my developme开发者_开发知识库nt.

Note a peculiar twist: the look (size) of the pulsating blue dot should preferably not depend on the zoom factor of the host view in its scroll view. I believe Map Kit behaves similarly.

The intent is to attract the user's attention to a specific tiny portion of a crowded image.

Thanks for any suggestion.


You could use two pre-generated images (one with "low light" and one with "high") and animate the transition between the two images. You'd want to use an ease-in curve similar to the map dot (speeds up as it gets brighter) and have it auto-reverse and repeat.

Alternatively, you could use a view with a blue-tinted shadow whose blur radius property is animated between zero and several pixels. With this latter approach, your custom-drawn dot could easily take the scale factor into account when drawing.

0

精彩评论

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