# Advanced camera

**URL:** <https://forum.kirupa.com/t/advanced-camera/287997>\
**Category:** programming\
**Created:** [May 9, 2009, 3:11am UTC](https://forum.kirupa.com/t/advanced-camera/287997 "2009-05-09T03:11:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![substance](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@substance](https://forum.kirupa.com/u/substance)\
**Post date:** [May 9, 2009, 3:11am UTC](https://forum.kirupa.com/t/advanced-camera/287997/1 "2009-05-09T03:11:26Z")

</div>

So I’m working on a new Camera object and I just wanted to know if I was going about things the right way(because my results vary). I want to be able to center on a point of interest and zoom in and out. Right now I have an overall stage (canvas) and then an array of ‘layers’ within the canvas that can move at different speeds. A few other factors are:

magnification = how far ‘zoomed’ the camera should be (1 = normal)  
damping = for parallax scrolling, some layers move slower than others (1 = normal)  
poi = point of interest, should be centered at all times

I cant seem to get the math right in figuring out my positions though, here’s what I have so far (not really working:

```auto
for(var i:int = 0;i < layers.length; i++){            
    layers*.x -= (layers*.x - poi.x + halfStageWidth * magnification) * layers*.damping;
    layers*.y -= (layers*.y - poi.y + halfStageHeight * magnification) * layers*.damping;
}   
canvas.scaleX = magnification;
canvas.scaleY = magnification;

```

Am I even going about this the right way? Does anyone have working examples of some good camera work?

\*\*Not interested in vCam
