So this is my code so far, just for zooming. I’m trying to make it so it zooms to the mid position of where the two touches are.

```
local change = (zdist-vec2(touches[1].x,touches[1].y):dist(vec2(touches[2].x,touches[2].y)))/200
screensize = screensize + change
if screensize < 0.1 then
screensize = 0.1
change = 0
elseif screensize > 3 then
screensize = 3
change = 0
end
local tch = {}
for k,v in pairs(touches) do
local tx = (touches[k].x-WIDTH/2)*screensize
local tdx = ((origin.x-screenpos.x)*screensize+(WIDTH/2))+tx
local ty = (touches[k].y-HEIGHT/2)*screensize
local tdy = ((origin.y-screenpos.y)*screensize+(HEIGHT/2))+ty
table.insert(tch,vec2(tdx,tdy))
end
local zp = (vec2(tch[1].x,tch[1].y)+vec2(tch[2].x,tch[2].y))/2
local dt = ((screenpos-zp)*-change)/screensize
screenpos = screenpos + dt
zdist
= (vec2(touches[1].x,touches[1].y):dist(vec2(touches[2].x,touches[2].y)))
```

The screenpos is the middle of the sprite displaying the screen and the screen size is a 1/scale, so smaller is larger. The change is the change in distance of the two touches and the code in the for loop converts the touch position to the screen position + scale so drawing works fine, its just a matter of moving the screen to the touch midpoint using the variable ‘dt’ which I haven’t cracked yet. I’m using the sprite and scale to translate the touches to draw and all draw positions so the scale() function isn’t used nor is translate. Any help is appreciated, thanks.