protected void setEyePosition( AnimationController animControl, View view, Position position, ViewInputAttributes.ActionAttributes attrib) { MoveToPositionAnimator posAnimator = (MoveToPositionAnimator) animControl.get(VIEW_ANIM_POSITION); double smoothing = attrib.getSmoothingValue(); if (!(attrib.isEnableSmoothing() && this.isEnableSmoothing())) smoothing = 0.0; if (smoothing != 0.0) { double elevation = ((FlyViewLimits) view.getViewPropertyLimits()) .limitEyeElevation(position, view.getGlobe()); if (elevation != position.getElevation()) { position = new Position(position, elevation); } if (posAnimator == null) { posAnimator = new MoveToPositionAnimator( view.getEyePosition(), position, smoothing, OrbitViewPropertyAccessor.createEyePositionAccessor(view)); animControl.put(VIEW_ANIM_POSITION, posAnimator); } else { posAnimator.setEnd(position); posAnimator.start(); } } view.firePropertyChange(AVKey.VIEW, null, view); }
private static void triggerAnimation(JComponent c, Part part, State newState) { if (c instanceof javax.swing.JTabbedPane || part == Part.TP_BUTTON) { // idk: we can not handle tabs animation because // the same (component,part) is used to handle all the tabs // and we can not track the states // Vista theme might have transition duration for toolbar buttons // but native application does not seem to animate them return; } AnimationController controller = AnimationController.getAnimationController(); State oldState = controller.getState(c, part); if (oldState != newState) { controller.putState(c, part, newState); if (newState == State.DEFAULTED) { // it seems for DEFAULTED button state Vista does animation from // HOT oldState = State.HOT; } if (oldState != null) { long duration; if (newState == State.DEFAULTED) { // Only button might have DEFAULTED state // idk: do not know how to get the value from Vista // one second seems plausible value duration = 1000; } else { XPStyle xp = XPStyle.getXP(); duration = (xp != null) ? xp.getThemeTransitionDuration( c, part, normalizeState(oldState), normalizeState(newState), Prop.TRANSITIONDURATIONS) : 1000; } controller.startAnimation(c, part, oldState, newState, duration); } } }
/** * Set the roll in a view. * * @param view View to modify. * @param animControl Animator controller for the view. * @param roll new roll value. * @param attrib action that caused the roll to change. */ protected void setRoll( View view, AnimationController animControl, Angle roll, ViewInputAttributes.ActionAttributes attrib) { double smoothing = attrib.getSmoothingValue(); if (!(attrib.isEnableSmoothing() && this.isEnableSmoothing())) smoothing = 0.0; AngleAnimator angleAnimator = new RotateToAngleAnimator( view.getRoll(), roll, smoothing, ViewPropertyAccessor.createRollAccessor(view)); animControl.put(VIEW_ANIM_ROLL, angleAnimator); }