I'm trying to implement a pinch zoom on a sprite. I would like to get an effect like the SmoothCamera, but on a single sprite. I've managed to pinch zoom on the sprite by changing its scale, but the zoom is really fast and not smooth... it doesn't feel right.
This code is on my sprite :
public class BoardSprite extends Sprite implements IPinchZoomDetectorListener {
...
private float scale = 1;
@Override
public void onPinchZoom(PinchZoomDetector pPinchZoomDetector,
TouchEvent pTouchEvent, float pZoomFactor) {
float newScale = scale * pZoomFactor;
if (newScale > 3) {
newScale = 3;
} else if ( newScale < 1) {
newScale = 1;
}
scale = newScale;
this.setScale(newScale);
}
I'm looking for a way to improve this solution or for a better approach.
float newScale = pZoomFactor;
-- what effect would that produce? \$\endgroup\$ – Thomas Jan 20 '14 at 13:54