Zooming in on specific point. (Translate and scale)

yes. you need to break up your translate into two stages, and do the scaling between them, while the center of your coordinate system is still at 0,0.

  1. translate(width/2, height/2);
  2. scale(amt)
  3. translate(-avgx, -avgy);

For a recent related discussion, see:

1 Like