kirill-grouchnikov / substance

A modern and high-performant Swing look-and-feel library
163 stars 110 forks source link

Disabling ProgressBar (and other) Animations #28

Closed EGjoni closed 7 years ago

EGjoni commented 7 years ago

Can't find anything in the docs about how to disable progress bar animations (specifically, how to prevent the progress bar from animating an interpolation between the old value and the new value after setValue() is called).

Docs state that

AnimationConfigurationManager.getInstance().disallowAnimations(.., ..)

can be used to disable animations on components. But animations persist when doing something like the following:

JButton btnEditColor = new JButton("Color");

AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.ROLLOVER, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.FOCUS, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.FOCUS_LOOP_ANIMATION, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.GHOSTING_BUTTON_PRESS, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.GHOSTING_ICON_ROLLOVER, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.SELECTION, btnEditColor);
AnimationConfigurationManager.getInstance().disallowAnimations(AnimationFacet.PRESS, btnEditColor);

I'm not sure if AnimationConfigurationManager is broken or if I'm just misunderstanding how to use it properly

kirill-grouchnikov commented 7 years ago

I'm going to add a bit of class-level comments in AnimationConfigurationManager about what can be controlled by its APIs.

Specifically, you have fine-grained controls over two classes of animations:

  1. Renderer-based controls such as tables, trees and lists
  2. Custom animations that Substance adds such as focus loop, icon glow etc

It would add too much runtime overhead to support such fine-grained control to every base facet (rollover, selection, press) of every single view. That is why you cannot turn off rollover animation, for instance, for a specific button.

EGjoni commented 7 years ago

I'm a bit unclear. Does this mean that progressbar interpolation animations cannot be disabled?

On Tue, Jun 27, 2017 at 9:34 AM, Kirill Grouchnikov < notifications@github.com> wrote:

Closed #28 https://github.com/kirill-grouchnikov/substance/issues/28.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kirill-grouchnikov/substance/issues/28#event-1140509847, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSno-rM4HvBSKQbc7VlFlEZCN2KoXHvks5sIQTfgaJpZM4OE3LO .

kirill-grouchnikov commented 7 years ago

Correct. You can call AnimationConfigurationManager.setTimelineDuration and pass 0, but that would effectively disable all Substance animations.