Reputation: 27394
I have my main game layer that is larger than the screen when the scene currently starts you see the character (a ship in this case) in the screen but I want to show the entire layer to the user first, and then animate back a zoom level of 1.
How can I achieve this? I know I can use the scale
property on CCLayer
but how can I tell how much of the view I am seeing such that I can show all of it?
Upvotes: 0
Views: 438
Reputation: 24771
Animate your zoom using a CCAction such as CCScaleTo
and set the end scale of the zoom in the CCScaleTo action to whatever you want as derived by comparing the screensize to the layer size. For example, to zoom in to a 2X magnification, your CCScaleTo would scale to a 2.0 scale. You could get even fancier and use the size of a particular object in the layer in comparison to the size of the layer and size of the screen to calculate a scale that brings the desired object to exactly the size you want after zooming.
Upvotes: 2