What is the logic of zooming sprite forever?

I have a question about sprite zooming. For example, I made a sprite:

class Scene_Zoom < Scene_Base def start super create_sprite end def create_sprite @sprite_zoomed = Sprite.new @sprite_zoomed.bitmap = Cache.picture("dragon_pearl") end def update super # this is where I want to put the sprite to zoom end endBy zooming, my problem is that I know how to zoom...but the problem is how would I make it so as if the pearl is breathing, or like, it zooms up on a certain point, then changes back to its original size (zoom out), then goes back to zooming in again? I am thinking of an if else statement but somehow it doesn't work that much as I want it to.

What is the logic of making it like its breathing?
Well IN GENERAL and not only in your situation here goes the logic:

You must start with gathering info:

You need the default zoom value.

Values that get involved and change need MAXIMUM value and MINIMUM value.

You might have a X and Y variable involved for example.

You also need a flag (boolean variable like a switch)

If the flag is FALSE you zoom in, increasing values, else you zoom out (reducing values).

If a value reaches its MAX allowed value, you switch the flag on.

If it reaches the MIN value you switch the flag off again.

Hope this helps you out. 😉
you might want the update method of the scene to add some counter. when reaching certain value. turn the flag (like above post said).

i'm doing that to my EST - PHONE MENU ENGINE (animated icon which move up and down). and it's a bit hard to execute. (especially when changing to other icon. i need to make sure there's not a single change to original coordinate of the previous icon).

Original thread: https://forums.rpgmakerweb.com/threads/what-is-the-logic-of-zooming-sprite-forever.38806/