private void sendMenuToBack() { if (isSentToFront) { new GVRPositionAnimation(this.getTransform(), Z_HOVER_ANIMATION_TIME, originalPosition[0], originalPosition[1], originalPosition[2]) .start(getGVRContext().getAnimationEngine()); isSentToFront = false; } }
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 bringMenuToFront() { if (!isSentToFront) { new GVRPositionAnimation(this.getTransform(), Z_HOVER_ANIMATION_TIME, originalPosition[0], originalPosition[1], originalPosition[2] + Z_HOVER_ANIMATION_OFFSET).start(getGVRContext() .getAnimationEngine()); isSentToFront = true; } }
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 slideToGridItem(boolean animated) { if (this.gridItem.y < PHOTO_VIEW_MIN_Y || this.gridItem.y > PHOTO_VIEW_MAX_Y) { fadeIn(); } else { fadeOut(); } if (animated) { new GVRPositionAnimation(this, PHOTO_VIEW_SCROLL_ANIMATION_TIME, this.gridItem.x, this.gridItem.y, this.gridItem.z).start(this.gvrContext.getAnimationEngine()); } else { this.getTransform().setPosition(this.gridItem.x, this.gridItem.y, this.gridItem.z); } }
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()); }
private void updateScrollbar(boolean animated, int scrollIndex) { float scrollFactor = GALLERY_SCROLLBAR_AREA_HEIGHT / (this.getNumberOfPages() - 2); float newYPosition = GALLERY_SCROLLBAR_Y_INITIAL_POSITION + ((scrollIndex - 1) * scrollFactor); if (animated) { new GVRPositionAnimation(this.scrollbar, GALLERY_SCROLLBAR_ANIMATION_TIME, this.scrollbar.getTransform().getPositionX(), newYPosition, this.scrollbar .getTransform().getPositionZ()).start(this.gvrContext .getAnimationEngine()); } else { this.scrollbar.getTransform().setPositionY(newYPosition); } }
private void closeActionWithFadeAnimation(int animationId) { AudioClip.getInstance(getGVRContext().getContext()).playSound(AudioClip.getUIImageCloseSoundID(), 1.0f, 1.0f); currentState = PHOTO_VIEW_ANIMATING; float x = rightGridItem.x; float y = rightGridItem.y; float z = rightGridItem.z; float offsetZ = 0.2f; if (animationId == PHOTO_VIEW_ANIMATION_LEFT_TO_RIGHT) { x = leftGridItem.x; y = leftGridItem.y; z = leftGridItem.z; } this.getTransform().setPosition(this.centeredGridItem.x, this.centeredGridItem.y, this.centeredGridItem.z - offsetZ); new GVRPositionAnimation(this, PHOTO_VIEW_FADE_ANIMATION_TIME, x, y, z - offsetZ) .start(this.gvrContext.getAnimationEngine()); new GVROpacityAnimation(this, PHOTO_VIEW_FADE_ANIMATION_TIME, PHOTO_VIEW_OPACITY_HIDE) .setOnFinish(new GVROnFinish() { @Override public void finished(GVRAnimation arg0) { PhotoView.this.getTransform().setScale(1.0f, 1.0f, 1.0f); PhotoView.this.getTransform().setPosition(gridItem.x, gridItem.y, gridItem.z); PhotoView.this.applyOpacityConstrants(); PhotoView.this.currentState = PHOTO_VIEW_CLOSED; } }).start(this.gvrContext.getAnimationEngine()); }