Class AnimationStack
java.lang.Object
de.rcblum.stream.deck.animation.AnimationStack
Structure that contains all necessary data to display an animation on a
key.
See
With too many animation at once, there is the possibility to break icon displayed.
MIT License
Copyright (c) 2017 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.
See
Animator for actually animating on a stream deck key.
With too many animation at once, there is the possibility to break icon displayed.
MIT License
Copyright (c) 2017 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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAnimation should be played at the frame rate of 15 frames per second.static final intAnimation should be played at the frame rate of 30 frames per second.static final intDeprecated.static final intAnimation should be looped when reaching the last framestatic final intAnimation should stop when reaching the last frame.static final intAnimation should be played in reverse when reaching on end of the frames.static final intThe animation should be playeed as soon as the accosiated item is displayed on a key.static final intThe animation should be played when the associated key is releasedstatic final intThe animation should be played when the associated key is pressed down -
Constructor Summary
ConstructorsConstructorDescriptionAnimationStack(int repeatType, boolean endAnimationImmediate, int frameRate, int trigger, SDImage[] frames) Creates AnimationStack without text.AnimationStack(int repeatType, boolean endAnimationImmediate, int frameRate, int trigger, SDImage[] frames, String text, int textPos) Creates AnimationStack with text. -
Method Summary
Modifier and TypeMethodDescriptionbooleanautoPlay()Returns if the animation should be played as soon as the item is displayed on the stream deckcopy()booleangetFrame(int frameNo) Returns the at the position given by the indexintReturns how many frames this animation has.intReutrns the frame rate at which the animation should be playedintReturns the repeat type of the animationintReturns the trigger for the animationgetVariant(Dimension targetSize) booleanisTriggered(KeyEvent.Type keyEventType) Returns if the animation should be triggered.booleanloop()Returns if the animation should be loopedbooleanpingPong()Returns if the animation should be reversed ass soon as the last frame in any direction is metbooleanplayOnce()Returns if the animation should be displayed oncevoidsetAnimationTrigger(AnimationTrigger animationTrigger) voidsetEndAnimationImmediate(boolean endAnimationImmediate) Sets if the animation should be stopped immediate after the trigger is not applicable anymore.voidSets the frames for the animationvoidSets the text to be displayed on the animationvoidSets the text to be displayed on the animationvoidsetTextPos(int textPos) Sets the text position of the displayed textvoidsetTrigger(int trigger) Change the trigger for the animations
-
Field Details
-
REPEAT_LOOPING
public static final int REPEAT_LOOPINGAnimation should be looped when reaching the last frame- See Also:
-
REPEAT_ONCE
public static final int REPEAT_ONCEAnimation should stop when reaching the last frame.- See Also:
-
REPEAT_PING_PONG
public static final int REPEAT_PING_PONGAnimation should be played in reverse when reaching on end of the frames.- See Also:
-
FRAME_RATE_15
public static final int FRAME_RATE_15Animation should be played at the frame rate of 15 frames per second.- See Also:
-
FRAME_RATE_30
public static final int FRAME_RATE_30Animation should be played at the frame rate of 30 frames per second.- See Also:
-
FRAME_RATE_60
Deprecated.Framerates above 30 FPS are note supported anymore. THe ESD breaks when using a to high framerate. Animation should be played at the
frame rate of 60 frames per second.- See Also:
-
TRIGGER_AUTO
public static final int TRIGGER_AUTOThe animation should be playeed as soon as the accosiated item is displayed on a key.- See Also:
-
TRIGGER_PRESSED
public static final int TRIGGER_PRESSEDThe animation should be played when the associated key is pressed down- See Also:
-
TRIGGER_CLICKED
public static final int TRIGGER_CLICKEDThe animation should be played when the associated key is released- See Also:
-
-
Constructor Details
-
AnimationStack
public AnimationStack(int repeatType, boolean endAnimationImmediate, int frameRate, int trigger, SDImage[] frames) Creates AnimationStack without text.- Parameters:
repeatType- If and how the animation should be repeated.endAnimationImmediate- Defines if the animation should be stopped immediate after the trigger expires, e.g. aborting the animation before it finishesframeRate- Frame rate the animation should be played attrigger- Trigger when the animation should be playedframes- Frames of the animation. In the stream deck compatible format, seeIconHelper.convertImage(java.awt.image.BufferedImage)
-
AnimationStack
public AnimationStack(int repeatType, boolean endAnimationImmediate, int frameRate, int trigger, SDImage[] frames, String text, int textPos) Creates AnimationStack with text.- Parameters:
repeatType- If and how the animation should be repeated.frameRate- Frame rate the animation should be played at (Max 30 fps).trigger- Trigger when the animation should be playedframes- Frames of the animation. In the stream deck compatible format, seeIconHelper.convertImage(java.awt.image.BufferedImage)text- Text to be displayed while the animation is runningtextPos- Position of the text on the frames (IconHelper.TEXT_TOP,IconHelper.TEXT_CENTER,IconHelper.TEXT_BOTTOM)
-
-
Method Details
-
autoPlay
public boolean autoPlay()Returns if the animation should be played as soon as the item is displayed on the stream deck- Returns:
trueif animation should start immediate as the item is displayed on the stream deck
-
endAnimationImmediate
public boolean endAnimationImmediate() -
getFrame
Returns the at the position given by the index- Parameters:
frameNo- Frame number to be returned- Returns:
- Frame for the given frameNo.
-
getFrameCount
public int getFrameCount()Returns how many frames this animation has.- Returns:
- Amount of frames
-
getFrameRate
public int getFrameRate()Reutrns the frame rate at which the animation should be played- Returns:
-
getRepeatType
public int getRepeatType()Returns the repeat type of the animation- Returns:
- int value of the repeat type
-
getTrigger
public int getTrigger()Returns the trigger for the animation- Returns:
- int value of the trigger for the animation
-
setTrigger
public void setTrigger(int trigger) Change the trigger for the animations -
isTriggered
Returns if the animation should be triggered.- Parameters:
keyEventType- Key event sent by the stream deck- Returns:
trueif the animation should be triggered,falseif not
-
loop
public boolean loop()Returns if the animation should be looped- Returns:
trueif the animation should be looped indefinatly,falseif not
-
pingPong
public boolean pingPong()Returns if the animation should be reversed ass soon as the last frame in any direction is met- Returns:
trueif the animation should ping pong between the last and the first frame,falseif not
-
playOnce
public boolean playOnce()Returns if the animation should be displayed once- Returns:
trueif the animation should only be displayed once,falseif not
-
setAnimationTrigger
-
setEndAnimationImmediate
public void setEndAnimationImmediate(boolean endAnimationImmediate) Sets if the animation should be stopped immediate after the trigger is not applicable anymore.- Parameters:
endAnimationImmediate-
-
setFrames
Sets the frames for the animation- Parameters:
frames- frames of the animation
-
setText
-
setText
Sets the text to be displayed on the animation- Parameters:
text-
-
setTextPos
public void setTextPos(int textPos) Sets the text position of the displayed text- Parameters:
textPos-
-
copy
-
getVariant
-