# Zooming in p5.play

**URL:** https://discourse.processing.org/t/zooming-in-p5-play/1464
**Category:** Libraries
**Created:** [July 3, 2018, 2:51pm UTC](https://discourse.processing.org/t/zooming-in-p5-play/1464 "2018-07-03T14:51:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![codingking03](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@codingking03](https://discourse.processing.org/u/codingking03)
#### Post date: [July 3, 2018, 2:51pm UTC](https://discourse.processing.org/t/zooming-in-p5-play/1464/1 "2018-07-03T14:51:01Z")

</div>

See [p5.play](http://molleindustria.github.io/p5.play/)  
In p5.play there is a camera function that allows the user to move around what part of the sketch they are looking at. I figured out that even when the camera is moved the mouseX/mouseY are still relative to the “screen” and are not affected. this is an easy fix, just add the displacement into a new variable. But, the camera also has a zoom feature, how would I find the function/equation to remove the displacement

---

<div class="post-metadata">

### Author: ![codingking03](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@codingking03](https://discourse.processing.org/u/codingking03)
#### Post date: [July 5, 2018, 6:10pm UTC](https://discourse.processing.org/t/zooming-in-p5-play/1464/2 "2018-07-05T18:10:19Z")

</div>

BUMP\_\_\_\_the bump then bump\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [July 5, 2018, 9:24pm UTC](https://discourse.processing.org/t/zooming-in-p5-play/1464/3 "2018-07-05T21:24:12Z")

</div>

In the above [link](http://molleindustria.github.io/p5.play/) in the main page, AWSD allows to control the rocket. Press `k` to fire

You are zooming using the camera property, right? This means you ahve control of the zoom. Based on this:

> [@codingking03](#):
>
> this is an easy fix, just add the displacement into a new variable

You know how to fix the displacement when the zoom is 1. If you have a zoom of 4, the a displacement of value dx should be corrected by the zoom factor. You do this by calculating: `dx_unzoom = dx / zoom` whee zoom is 4. If this does not answer your question, please provide some code showing your initial approach for this corrections.

Kf

---

<div class="post-metadata">

### Author: ![codingking03](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@codingking03](https://discourse.processing.org/u/codingking03)
#### Post date: [July 6, 2018, 8:05pm UTC](https://discourse.processing.org/t/zooming-in-p5-play/1464/4 "2018-07-06T20:05:42Z")

</div>

I will try it and get back to this thread thanks 🙂
