@Override public void onClick(View view) { if (view.getId() == id.next) { position++; updateNotes(); } else if (view.getId() == id.previous) { position--; updateNotes(); } else if (view.getId() == id.play) { PinView pinView = (PinView) findViewById(id.imageView); Random random = new Random(); if (pinView.isReady()) { float maxScale = pinView.getMaxScale(); float minScale = pinView.getMinScale(); float scale = (random.nextFloat() * (maxScale - minScale)) + minScale; PointF center = new PointF(random.nextInt(pinView.getSWidth()), random.nextInt(pinView.getSHeight())); pinView.setPin(center); AnimationBuilder animationBuilder = pinView.animateScaleAndCenter(scale, center); if (position == 3) { animationBuilder .withDuration(2000) .withEasing(SubsamplingScaleImageView.EASE_OUT_QUAD) .withInterruptible(false) .start(); } else { animationBuilder.withDuration(750).start(); } } } }