/** * TODO refactor to remove this method Creates new animation manager * * @param kernel2 * kernel * @return animation manager */ public AnimationManager newAnimationManager(Kernel kernel2) { return new AnimationManager(kernel2); }
/** * @return current frame rate */ final public double getFrameRate() { return animationManager.getFrameRate(); }
/** * @return whether animation is paused */ final public boolean isAnimationPaused() { return animationManager != null && animationManager.isPaused(); }
/** * Stops animation */ public synchronized void stopAnimation() { if (isRunning()) { stopTimer(); updateNeedToShowAnimationButton(); } }
/** * Starts animation */ public synchronized void startAnimation() { if (kernel.getApplication().isScreenshotGenerator()) { return; } if (!isRunning() && animatedGeos.size() > 0) { updateNeedToShowAnimationButton(); startTimer(); } }
private boolean handlePressAnimationButton() { if (!getActiveEuclidianView().isAnimationButtonSelected()) { return false; } AnimationManager animMgr = kernel.getAnimatonManager(); if (animMgr.isRunning()) { animMgr.stopAnimation(); } else { animMgr.startAnimation(); } getActiveEuclidianView().repaintView(); ScreenReader.readAnimationState(this); return true; }
/** * Sets the state of this object to animating on or off. * * @param flag * true to make this animating * * @see Animatable interface */ public synchronized void setAnimating(final boolean flag) { final boolean oldValue = animating; animating = flag && isAnimatable(); // tell animation manager if (oldValue != animating) { final AnimationManager am = kernel.getAnimatonManager(); if (animating) { am.addAnimatedGeo(this); } else { am.removeAnimatedGeo(this); } } }
/** * @return whether animation is running */ final public boolean isAnimationRunning() { return animationManager != null && animationManager.isRunning(); }
animationManager.stopAnimation(); animationManager.clearAnimatedGeos();
GeoElement.updateCascade(changedGeos, getTempSet(), false); .getLastRepaintTime(); adaptFrameRate(compTime);
/** * Toggle animation falg */ public void animationCmd() { ArrayList<GeoElement> geos2 = checkOneGeo(); for (int i = geos2.size() - 1; i >= 0; i--) { GeoElement geo1 = geos2.get(i); if (geo1.isAnimatable()) { geo1.setAnimating(!(geo1.isAnimating() && app.getKernel().getAnimatonManager().isRunning())); geo1.updateRepaint(); } } app.storeUndoInfo(); app.getActiveEuclidianView().repaint(); // automatically start animation when animating was turned on if (getGeo().isAnimating()) { getGeo().getKernel().getAnimatonManager().startAnimation(); } }
/** * @return whether animation button is needed */ final public boolean needToShowAnimationButton() { if (!showAnimationButton) { return false; } return animationManager != null && animationManager.needToShowAnimationButton(); }
/** * Returns whether the animation is currently paused, i.e. the animation is * not running but there are elements with "Animation on" set. * * @return true when paused */ public boolean isPaused() { return !isRunning() && animatedGeos.size() > 0; }
@Override public boolean isAnimationRunning() { return kernel.getAnimatonManager().isRunning(); }
/** * Reads information about the animation state. * * @param app * the application. */ public static void readAnimationState(App app) { String text = ""; Localization loc = app.getLocalization(); if (app.getKernel().getAnimatonManager().isRunning()) { text = loc.getMenuDefault("AnimationStarted", "animation is started"); } else { text = loc.getMenuDefault("AnimationStopped", "animation is stopped"); } ScreenReader.readText(text, app); }
/** * Reads information about the play button on EV. * * @param app * the application. */ public static void readEVPlay(App app) { Localization loc = app.getLocalization(); ScreenReaderBuilder sb = new ScreenReaderBuilder(); sb.append(loc.getMenu("PlayButton")); sb.endSentence(); if (app.getKernel().getAnimatonManager().isRunning()) { sb.append( loc.getMenuDefault("PressSpaceStopAnimation", "Press space to stop animation")); } else { sb.append(loc.getMenuDefault("PressSpaceStartAnimation", "Press space to start animation")); } sb.endSentence(); readText(sb.toString(), app); }