Class Animator
java.lang.Object
de.rcblum.stream.deck.animation.Animator
- All Implemented Interfaces:
StreamKeyListener, Runnable
Controller that handles the animation of a key.
BUGFIX:
2019-01-13 RvW: If the animation had only one frame and mode pingpong,
MIT License
Copyright (c) 2018 Roland von Werden
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
run() would reduce the framePos to -1 finally resulting
in a NullPointerException in the run method of SoftStreamDeck.WriterDaemon.
Fixed by checking bounds of framePos after calculating the new position.
MIT License
Copyright (c) 2018 Roland von Werden
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Version:
- 1.0.0
- Author:
- Roland von Werden
-
Constructor Summary
ConstructorsConstructorDescriptionAnimator(IStreamDeck streamDeck, int keyIndex, AnimationStack animation) Creates an animator for the given stream deck key andAnimationStack -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAnimationListener(AnimationListener listener) Adds an animation listenerReturns the current icon of the animationbooleanisActive()Returns boolean if the animation is activevoidonKeyEvent(KeyEvent event) Checks if the key event should start the animationbooleanremoveAnimationListener(AnimationListener listener) Remvoes an animation listenervoidrun()Displays one frame of the animationvoidstart()Starts the animationvoidstop(boolean immediate) Stops the animation.
-
Constructor Details
-
Animator
Creates an animator for the given stream deck key andAnimationStack- Parameters:
streamDeck- Stream Deck with the keykeyIndex- Index of the keyanimation-AnimationStackthat contains framrate trigger loop behavior and frames of the animation
-
-
Method Details
-
getCurrentIcon
Returns the current icon of the animation- Returns:
- Current frame of the animation
-
onKeyEvent
Checks if the key event should start the animation- Specified by:
onKeyEventin interfaceStreamKeyListener- Parameters:
event-
-
start
public void start()Starts the animation -
stop
public void stop(boolean immediate) Stops the animation.- Parameters:
immediate-trueif animation should be stopped immediate,falseif the animation should end first. Looped and ping pong animations will not stop withfalse.
-
run
-
isActive
public boolean isActive()Returns boolean if the animation is active- Returns:
trueif animation is running,falseif not
-
addAnimationListener
Adds an animation listener- Parameters:
listener- Listener to be added- Returns:
trueif the listener was added,falseif not
-
removeAnimationListener
Remvoes an animation listener- Parameters:
listener- Listener to be removes- Returns:
trueif the listener was removed,falseif not
-