Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animated transitions between decoration states #355

Open
mgarin opened this issue Feb 1, 2016 · 1 comment
Open

Animated transitions between decoration states #355

mgarin opened this issue Feb 1, 2016 · 1 comment

Comments

@mgarin
Copy link
Owner

mgarin commented Feb 1, 2016

Decoration-based styling system will be out and live soon, but it still requires one big addition - animated transition between the states. This feature will allow you to provide short transition animation description within decoration states to enable animated transitions.

Here is a small theoretical example of how it will look like for the button:

    <style type="button">
        <painter class="WebButtonPainter">
            <decorations>
                <decoration round="3">
                    <BasicShade type="outer" width="2" />
                    <LineBorder color="170,170,170" />
                    <GradientBackground type="linear" from="0,0" to="0,1">
                        <color>white</color>
                        <color>223,223,223</color>
                    </GradientBackground>
                    <Animate to="pressed" time="100" fps="60" />
                </decoration>
                <decoration states="focused">
                    <BasicShade type="outer" color="85,142,239" />
                </decoration>
                <decoration states="pressed">
                    <BasicShade type="outer" transparency="0" />
                    <BasicShade type="inner" width="5" />
                    <ColorBackground color="210,210,210" />
                    <Animate time="400" fps="60" />
                </decoration>
                <decoration states="disabled">
                    <BasicShade type="outer" transparency="0" />
                    <LineBorder color="lightGray" />
                </decoration>
            </decorations>
        </painter>
    </style>

This describes two simple animations:

  1. Quick animation for button press
  2. Long animation for button release

The way transition is performed will be described within each separate part of the decoration - shape, shade, border, background etc. If some parts do not support it they will simply ignore animation requests.

Separate animation pipe (thread) is probably required to efficiently implement this feature without creating huge amount of threads to animate each separate part of the decoration.

@mgarin mgarin self-assigned this Feb 1, 2016
@mgarin mgarin added this to the v1.3.0 milestone Feb 1, 2016
mgarin added a commit that referenced this issue Oct 31, 2016
- AnimationManager.java - Basic implementation added to use in different niche cases until the final implementation is available in v1.3.0 [ #355 ]
- Transition.java - Base for all kinds of transition implementations, each transition defines how exactly progress goes and is able to provide modified value at any time
- TimedTransition.java - Transition implementation that ensures that transition is finished within the given time
- QueueTransition.java - Transition implementation that allows grouping different transitions into a queue to be performed on by one, queue can also be looped
- IdleTransition.java - Transition implementation that allows providing simple idle transition taking up some time on the timeline, it is pointless as a standalone transition but highly useful in combination with `QueueTransition`
- FrameRate.java - Base for all frame rate definitions, each frame rate should either be fixed - if it never changes - or variable - if it could be changed in runtime
- FixedFrameRate.java - Simple `FrameRate` implementation that encloses fixed frame rate value
- TypeTransition.java - Base for different value types support within transitions, each type transition defines how exactly object instance of the described type can be modified
- IntegerTransition.java, LongTransition.java, FloatTransition.java, DoubleTransition.java, ColorTransition.java - Basic type transition implementations for different object types
- AnimationPipeline.java - Base for animation pipeline implementations, each pipeline is able to play multiple transitions at once
- AnimationPipelineFactory.java - Base for animation pipeline factory implementations, each factory should be able to provide appropriate pipelines for provided transitions
- TimedAnimationPipeline.java - Advanced pipeline implementation that tries to do its best to perform each animation frame exactly on time
- TimedAnimationPipelineFactory.java - Factory implementation for `TimedAnimationPipeline`
- FramedAnimationPipeline.java - Basic pipeline implementation that performs animation frames at a static rate based on the specified frame rate
- FramedAnimationPipelineFactory.java - Factory implementation for `FramedAnimationPipeline`
- EventHandler.java - Base for any kinds of event handlers, not just Swing events
- SingleThreadHandler.java - `EventHandler` implementation that submits all incoming events into single-threaded executor service
- EventDispatchThreadHandler.java - `EventHandler` implementation that submits all incoming events into Swing Event Dispatch Thread, set as the default event handler in `AnimationManager`
- TransitionListener.java, TransitionAdapter.java - Transition events listeners, can be added into or removed from any transition implementation
- Easing.java - Every easing implementation should now provide its own title
- Bounce.java - Fixed `In` and `InOut` easing functions

Decoration
- AbstractDecorationPainter.java - State decorations cache doesn't duplicate non-unique decorations for different decoration states anymore leading to faster initialization and lesser memory usage
- TextRasterization.java, SwingUtils.java - Added new enumeration to properly reflect text rasterization options
- StyleConstants.java - Removed old constants which kept different text rendering hints, those can now be acquired from `TextRasterization` enum
- AbstractTextContent.java - Added `rasterization` option usage as a new and more streamlined way of configuring text rasterization, `subpixel` one is used by default
- AbstractDecorationPainter.java - Fixed component orientation state update for all painters
- AbstractDecorationPainter.java - Content is now always painted, method will still be removed upon completion of all styling-related changes
- Fixed `overwrite` setting inheritance on merge operations

ProgressBar
- ProgressBarPainter.java - Proper progress, text and animation according to component orientation [ #154 ]
- IProgressTextPainter.java, ProgressTextPainter.java - Added to provide an additional painting layer on progress bar for the text
- ProgressBarText.java - Custom text content implementation for progress bar component
- ProgressBarPainter.java, progressbar.xml - Added proper `IContent`-based text painting implementation
- WebProgressBarUI.java - Doesn't extend basic UI class anymore for better state updates and redundant settings removal
- WProgressBarUI.java, WebProgressBar.java - Added `WProgressBarUI` as a new base WebLaF UI class for progress bar

Calendar
- WebCalendar.java - Fixed visual update issue for the cases when month or year doesn't change [ #412 ]

Frame, Dialog
- WebRootPaneUI.java, WindowTitleBehavior.java - Added glass dialog for displaying frame attachment side under Windows OS [ #413 ]
- StyleId.java, frame.xml, frame.xml - Added default glass dialog style
- frame.xml, dialog.xml - Fixed UI decorations mark for dark style
- frame.xml, dialog.xml - Added better corners rounding values

ToolBar
- StyleId.java, toolbar.xml, toolbar.xml - Added additional attached styles with appropriate gradient directions
- styleeditor.xml, directorychooser.xml, filechooser.xml, ninepatcheditor.xml - Updated extended toolbar style names

Table
- WebTable.java - Now displays 10 rows by default and will only go back to preferred size when visible row count is set to -1

Link
- AsyncLinkAction.java - Executor service now uses daemon thread factory

Icons
- Icons.java, web.xml, dark.xml, hourglass.svg, broken.svg - New light and dark flat icons added
- StyleConstants.java, WebLookAndFeel.java - Moved HTML icons for image states into icon set
- StyleConstants.java, missingImage.png, pendingImage.png - Removed as deprecated

Language
- language.xml - Added short translations for time units

API
- WebLookAndFeel.java - Added global `enforceEventDispatchThread` setting you can set to `true` to enable EDT checks within UI-related WebLaF code [ #414 ]
- LookAndFeelException.java - New exception class for L&F-specific exceptions like the new one thrown upon Swing components usage within non-EDT threads
- Overwritable.java - New interface for overwritable data classes
- IDecoration.java, IContent.java, IShape.java, IShadow.java, IBorder.java, IBackground.java - Now extend `Overwritable` to ensure all descendants implement it
- Added `Overwritable` interface implementation into all specific abstract and complete decoration and content implementations
- Updated various classes to use `SystemUtils` instead of custom code to ensure correct display bounds calculation

Utilities
- TextUtils.java - Enhanced delay parsing to enable double values to be read
- SystemUtils.java - Added various methods to retrieve screen bounds
- SwingUtils.java - Moved `getScreenBounds` method to `SystemUtils`
- SwingUtils.java - Added `isDoubleClick` methods to simplify and enhance the commonly used check
- TimeUtils.java - Moved time constants here from `TextUtils`
- WebTimer.java - Disabled inpterruption exception logging as redundant

Demo
- Added easing and transitions example to demonstrate basic animations in action
- Added more progress bar examples to demonstrate appearance for different settings
- Reworked base example and preview classes to allow more configuration options
- Demo application UI is now always running purely in EDT thread without any exceptions

Project
- rsyntaxtextarea-2.6.0.jar - Updated from version 2.5.8 to latest 2.6.0 build
- pom.xml, build.properties - Updated according to new library version
@mgarin
Copy link
Owner Author

mgarin commented Nov 3, 2016

There have been a big update for this major feature - I had some parts of the animation system in development in my local project and I decided to push them to the styling branch so that they make it to the v1.2.9 update.

The reason behind this is that some parts of the UI - like indeterminate progress bars - had to be animated to provide appropriate visual representation of the component state. There are also quite a few cases in which transitions will be really useful to simplify the code and avoid performance issues.

So instead of writing more workarounds for all those cases I decided to include basic parts of animation system coming in v1.3.0 into this release. Though it is only a small part that provides transitions and easing API and it is not yet integrated with the styling system - that integration is a big feature that will only appear in v1.3.0.

Articles covering new APIs and features will soon be added in the wiki. I'll post a separate update here as soon as those are available.

@mgarin mgarin removed this from the v1.9.0 milestone Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant