private void swipeAnimation() { GVRPositionAnimation positionAnimationHand = new GVRPositionAnimation(hand, 1f, swipeIndicator.getTransform().getPositionX() + .3f, hand.getTransform().getPositionY() , hand.getTransform().getPositionZ()); positionAnimationHand.setOnFinish(new GVROnFinish() { @Override public void finished(GVRAnimation arg0) { new GVROpacityAnimation(swipeIndicator, 1, 0).start(gvrContext.getAnimationEngine()); new GVROpacityAnimation(hand, 1, 0).start(gvrContext.getAnimationEngine()); } }).start(gvrContext.getAnimationEngine()); }
public void closeAction() { AudioClip.getInstance(getGVRContext().getContext()).playSound(AudioClip.getUIImageCloseSoundID(), 1.0f, 1.0f); currentState = PHOTO_VIEW_CLOSED; if (this.PhotoItemListener != null) { this.PhotoItemListener.dispatchLockRequest(); } new GVRScaleAnimation(this, PHOTO_VIEW_OPEN_ANIMATION_TIME, 1.0f).start(this.gvrContext .getAnimationEngine()); new GVRPositionAnimation(this, PHOTO_VIEW_CLOSE_ANIMATION_TIME, gridItem.x, gridItem.y, gridItem.z) .setOnFinish(new GVROnFinish() { @Override public void finished(GVRAnimation arg0) { PhotoView.this.applyOpacityConstrants(); if (PhotoView.this.PhotoItemListener != null) { PhotoView.this.PhotoItemListener.dispatchUnlockRequest(); PhotoView.this.PhotoItemListener .itemUnselectedAnimationFinished(PhotoView.this); } } }).start(this.gvrContext.getAnimationEngine()); }
private void openAction() { AudioClip.getInstance(getGVRContext().getContext()).playSound(AudioClip.getUIImageOpenSoundID(), 1.0f, 1.0f); currentState = PHOTO_VIEW_OPENED; this.getTransform().setScale(1.0f, 1.0f, 1.0f); this.getRenderData().getMaterial().setColor(Color.WHITE); PhotoView.this.PhotoItemListener.dispatchLockRequest(); new GVRScaleAnimation(this, PHOTO_VIEW_OPEN_ANIMATION_TIME, PHOTO_VIEW_FOCUS_SCALE).start(this.gvrContext .getAnimationEngine()); new GVRPositionAnimation(this, PHOTO_VIEW_OPEN_ANIMATION_TIME, centeredGridItem.x, centeredGridItem.y, centeredGridItem.z) .setOnFinish(new GVROnFinish() { @Override public void finished(GVRAnimation arg0) { if (PhotoView.this.PhotoItemListener != null) { PhotoView.this.PhotoItemListener.dispatchUnlockRequest(); PhotoView.this.PhotoItemListener .itemSelectedAnimationFinished(PhotoView.this); } } }).start(this.gvrContext.getAnimationEngine()); }
protected void openActionWithAnimation(int animationId) { AudioClip.getInstance(getGVRContext().getContext()).playSound(AudioClip.getUIImageOpenSoundID(), 1.0f, 1.0f); currentState = PHOTO_VIEW_ANIMATING; this.getRenderData().getMaterial().setOpacity(PHOTO_VIEW_OPACITY_HIDE); this.getTransform().setScale(PHOTO_VIEW_FOCUS_SCALE, PHOTO_VIEW_FOCUS_SCALE, PHOTO_VIEW_FOCUS_SCALE); this.getRenderData().getMaterial().setColor(Color.WHITE); float x = leftGridItem.x; float y = leftGridItem.y; float z = leftGridItem.z; float offsetZ = 0; if (animationId == PHOTO_VIEW_ANIMATION_LEFT_TO_RIGHT) { x = rightGridItem.x; y = rightGridItem.y; z = rightGridItem.z; } this.getTransform().setPosition(x, y, z); new GVRPositionAnimation(this, PHOTO_VIEW_FADE_ANIMATION_TIME, this.centeredGridItem.x, this.centeredGridItem.y, this.centeredGridItem.z).setOnFinish(new GVROnFinish() { @Override public void finished(GVRAnimation arg0) { PhotoView.this.currentState = PHOTO_VIEW_OPENED; } }).start(this.gvrContext.getAnimationEngine()); new GVROpacityAnimation(this, PHOTO_VIEW_FADE_ANIMATION_TIME, PHOTO_VIEW_OPACITY_VISIBLE) .start(this.gvrContext .getAnimationEngine()); }