actionscript 3 - Flash AS3 | Creation of a Camera / Moving Viewport / Zoom -
i looking extend on question asked earlier here:
flash as3 | pan / zoom mouse input
the basis solution working, looking improve process more achieve higher quality result.
what asking here if me find way make 'viewport' (what displayed on screen) tied or follows object around. pointing scope of sniper rifle example, see image through hud, , see different parts of image hud moves around.
alongside this, there way me implement zoom feature? guess enlarge actual displayed image itself, on great!
thanks once again guys!
i think 1 way achieve effect you're looking take content want have on screen , put inside movieclip. then, when have name movieclip, can adjust it's positioned it's focused around 1 object, this:
holder.x = screenwidth/2 - holder.object.x; holder.y = screenheight/2 - holder.object.y;
this little bit of math takes object's position relative holder
movieclip , adjusts whole movieclip moved, putting spot in center.
once have there, can zoom adjusting scalex
, scaley
of holder
movieclip, 1 default value both 200% zoom 2 , on. however, movieclip zoom anchor point, not center of screen, may have move movieclip anytime want scale it.
Comments
Post a Comment