Incari Studio
2021.5
2021.5
  • Incari HMI Development Platform
  • Demo Projects
    • Overview
    • 4 Methods of Animation
    • Using APIs to Pull Dynamic Data
    • An Analog Clock
    • Image Sequence Button Animation
  • Getting Started
    • Requirements
    • What's New
    • Installation
    • Project Objects
      • Scene
      • Screen
    • Scene Objects
      • Camera
      • Group
      • Lights
      • List
      • Mesh
      • Sprite
      • Text
      • Web Sprite
      • Primitives
      • Screen Space Elements
    • Attributes
      • Attribute Types
        • Asset/Object Attribute
        • Boolean Attribute
        • Color Attribute
        • Numerical Attribute
      • Common Attributes
        • Object
        • Camera
        • Rotation Pivot
        • Sprite
        • Transformation
    • Data Types
      • Bool
      • Byte
      • Float
      • Int
      • String
      • Vector2
      • Vector3
      • Vector4
    • Terminology
  • Modules
    • Asset Manager
    • Animation Editor
    • Attribute Editor
    • Code Editor
    • Console
    • Exporter
    • Image Sequence Editor
    • Logic Editor
    • Global Preferences
    • Material Editor
    • Model Editor
    • Profiler View
    • Project Outliner
    • Project Settings
    • Scene Outliner
  • Toolbox
    • Actions
      • Delay Action
      • FadeFromTo Action
      • FadeTo Action
      • MoveBy Action
      • MoveTo Action
      • RotateBy Action
      • RotateTo Action
      • RotateFromTo Action
      • ScaleBy Action
      • ScaleTo Action
    • Array
      • Array Value
      • Clear Array
      • Concat Arrays
      • Get Array Element
      • Length of Array
      • Pop Array Element
      • Push Array Element
      • Set Array Element
    • Binary
      • Binary (Hex) Value
      • Concat Binaries
    • Communication
      • CAN
        • Events
          • On CAN Start
          • On CAN Stop
          • On CAN Packet Received
        • CAN Start
        • CAN Stop
        • CAN Send Packet
      • HTTP
        • Events
          • On HTTP Route
          • On HTTP Server Start
          • On HTTP Server Stop
        • HTTP Client
        • HTTP Response
        • HTTP Server Start
        • HTTP Server Stop
      • MQTT
        • Events
          • On MQTT Start
          • On MQTT Stop
          • On MQTT Topic
        • MQTT Start
        • MQTT Stop
        • MQTT Subscribe
        • MQTT Publish
      • Serial
        • Events
          • On Serial Start
          • On Serial Stop
          • On Serial Packet Receive
          • On Serial Error
        • Serial Start
        • Serial Stop
        • Serial Send Packet
    • DateTime
      • Date Time Formatter
      • Now (UTC)
      • System Time
      • Timezone Value
    • Development
      • Assert
      • Benchmark Get
      • Benchmark Start
      • Benchmark Stop
      • Clear Console
      • Console
      • Profiler Start
      • Profiler Stop
    • Dictionary
      • Clear Dictionary
      • Dictionary Value
      • Erase Dictionary Element
      • Get Dictionary Element
      • Get Dictionary Keys
      • Get Dictionary Values
      • Merge Dictionaries
      • Set Dictionary Element
      • Size of Dictionary
    • Events
      • Custom
        • Event Listener
        • Event Trigger
      • Gestures
        • On Swipe
        • On Tap
      • ImageSequence
        • On ImageSequence Frame Changed
        • On ImageSequence Pause
        • On ImageSequence Play
        • On ImageSequence Stop
      • Keyboard
        • On Key Press
        • On Key Release
      • List
        • On List Current Index Change
        • On List Entry Select
        • On List Load
      • Mouse
        • On Hover Enter
        • On Hover Leave
        • On Mouse Button Down
        • On Mouse Button Up
        • On Mouse Click
        • On Mouse Double Click
        • On Mouse Enter
        • On Mouse Leave
        • On Mouse Move
        • On Mouse Scroll
      • Object
        • On Alpha Change
        • On Opacity Change
        • On Position Change
        • On Rotation Change
        • On Scale Change
        • On Visibility Change
      • On-Screen Keyboard
        • On On-Screen Keyboard Arrow Down Pressed
        • On On-Screen Keyboard Arrow Up Pressed
        • On On-Screen Keyboard Enter Pressed
        • On On-Screen Keyboard Input Changed
        • On On-Screen Keyboard Key Pressed
      • Variables
        • On Variable Change
        • On Variable Set
      • Video
        • On Video Play
        • On Video Finish
      • Web
        • On Javascript Callback
      • WebSprite
        • On WebSprite Load
    • Flow Control
      • Branch
      • For Each Loop
      • For Loop
      • Index Switch
      • Is Equal
      • Is Greater Equal
      • Is Less Equal
      • Select Data
      • Sequential
      • Switch
      • Toggle
    • Functions
      • Function
        • Function Input
        • Function Output
    • Incari
      • Animation
        • Pause Animation
        • Play Animation
        • Stop Animation
      • ImageSequence
        • Play ImageSequence
        • Pause ImageSequence
        • Stop ImageSequence
        • Resume ImageSequence
        • Get Current ImageSequence Frame
        • Get ImageSequence Duration
        • Get ImageSequence FPS
        • Get ImageSequence Total Frames
        • Go To Next ImageSequence Frame
        • Go To Previous ImageSequence Frame
        • Show ImageSequence Frame
        • This Scene
      • List
        • Generate List
        • Next List Entry
        • Previous List Entry
        • Select List Entry
        • Set Active
        • Set Current Index
      • Object
        • Get Alpha
        • Get Material
        • Get Opacity
        • Get Position
        • Get Position Pixel
        • Get Rotation
        • Get Rotation 2D
        • Get Scale
        • Get Size Pixel
        • Get Tint
        • Get Visibility
        • Set Alpha
        • Set Material
        • Set Position
        • Set Position Pixel
        • Set Rotation
        • Set Rotation 2D
        • Set Scale
        • Set Size Pixel
        • Set Text
        • Set Tint
        • Set Visibility
        • Set Opacity
      • On-Screen Keyboard
        • On-Screen Keyboard Clear Input
        • On-Screen Keyboard Get Input
        • On-Screen Keyboard Move Selection
        • On-Screen Keyboard Press Button
      • Vector
        • Arc
          • Set ArcStart
          • Set ArcEnd
          • Get ArcStart
          • Get ArcEnd
        • Label
          • Get LabelText
        • Line
          • Set LineWidth
          • Get LineWidth
        • Pie
          • Set PieStart
          • Set PieEnd
          • Get PieStart
          • Get PieEnd
        • Rectangle
          • Set RectangleCorners
          • Get RectangleCorners
        • Set BackgroundColor
        • Get BackgroundColor
        • Set FillColor
        • Get FillColor
        • Set StrokeWidth
        • Get StrokeWidth
      • Video
        • Is Video Playing
        • Pause Video
        • Play Video
        • Seek Video
        • Stop Video
      • WebSprite
        • Get Remote URL
        • Set Remote URL
        • Web Sprite Reload
    • IO
      • Load File
      • Save File
    • Math
      • Absolute
      • Add
      • Average
      • Boolean
        • AND
        • Bool Value
        • Negate
        • OR
      • Ceil
      • Clamp
      • Decrement
      • Divide
      • Floor
      • Increment
      • Interpolate
      • Logarithm
      • Math Constant
      • Maximum
      • Minimum
      • Modulo
      • Multiply
      • Numerical Value
      • Power
      • Random
      • Range Mapper
      • Root
      • Rotation Matrix
      • Subtract
      • Trigonometry
        • Arc Cosine
        • Arc Sine
        • Arc Tangent
        • Cosine
        • Radian-Degree Converter
        • Sine
        • Tangent
      • Vector Value
    • String
      • Capitalize
      • CharCodeAt
      • Compare
      • Concat Strings
      • Contains
      • EndsWith
      • CryptoHash
      • Flatten
      • Format
      • IndexOf
      • Join
      • JSON Parse
      • JSON Stringify
      • LastIndexOf
      • Length
      • Lower
      • IsLower
      • MatchRegex
      • PaddingLeft
      • PaddingRight
      • RandomString
      • RemoveCharacters
      • Replace
      • ReplaceRegex
      • Reverse
      • Split
      • StartsWith
      • String Value
      • Trim
      • TrimLeft
      • TrimRight
      • Upper
      • IsUpper
    • Utilities
      • Color Value
      • Conversion
      • Create CustomID
      • Create Object
      • Get Command Line Option
      • Group
      • Interval
        • Reset Interval
        • Start Interval
      • Is Data Type
      • Is Object Type
      • System Call
      • Timeout
        • Cancel Timeout
        • Start Timeout
    • Variables
      • Variable Getter
      • Variable Setter
    • Web
      • Call JavaScript Function
Powered by GitBook
On this page
  • Overview
  • Image Sequences
  • Logic
  • All Nodes
  • Logic Groups
  • 'On Mouse Enter' Group
  • On Mouse Enter Event Node
  • Custom Function Node
  • Play ImageSequence Node
  • 'On Mouse Leave' Group
  • 'On Mouse Press' Group
  • 'On Mouse Release' Group

Was this helpful?

  1. Demo Projects

Image Sequence Button Animation

PreviousAn Analog ClockNextRequirements

Last updated 3 years ago

Was this helpful?

Overview

This simple button animation uses the feature to create an interactive, animated button. When the mouse hovers over the button, the button animates to a half-pressed state. When the mouse moves off of the button, the button returns to the original unpressed state. When the mouse is pressed, the button animates to a fully pressed state and returns to the original unpressed state upon release.

Image Sequences

Logic

All Nodes

  • Object Node

    • ImageSequence Object Node 'Button'

    • 'Stop Image Sequence'

Logic Groups

We will use the green Group 'On Mouse Enter' to explain how the Logic of each group functions.

'On Mouse Enter' Group

On Mouse Enter Event Node

Custom Function Node

Play ImageSequence Node

'On Mouse Leave' Group

'On Mouse Press' Group

'On Mouse Release' Group

Although Incari's built-in tools are powerful, there are many use cases where the desired effect can't be achieved using Incari alone. In this case, it often makes more sense to create animations in dedicated animation software. Most tools, such as Adobe After Effects, provide an easy way of exporting an animation as an Image Sequence, most commonly in the .png file format. By using Incari's Image Sequence Object and , we can take these frames and combine them with Incari's Logic system.

Files of the .incseq type are Image Sequences. To open the file, simply double-click it and the will open. Here you can see all of the images of the sequence arranged in order.

To create this type of file, simply right-click in the and select "Create Asset > Image Sequence". Then double-click it to open the , drag the images into it directly from the , and then click the save icon to save it.

This Demo Project uses a combination of , an Object Node, , and a to make the button animation function as desired.

There are four groups of Logic in the Project, each triggered by one of the four used: , , , and .

The only difference between the groups is the that triggers them and the of the at the end.

The first Node in the Logic is the . This means that when the mouse enters the area of the designated Object, the is fired. In this case, the Object designated in the Node is the Button ImageSequence Sprite Object. You can designate an Object by dragging the Object from the into the Node Attributes of the Event Node.

The next Node in the Logic is the . This Function takes the input of the Image Sequence Sprite Object ('Button') as an Object ID, gets the current frame of the Image Sequence with the , stops the Image Sequence with a , and outputs the last shown frame of the Image Sequence before it was stopped.

It is important to save the last shown frame of the Image Sequence before the Image Sequence is stopped, because the resets the current frame of the Image Sequence back to the first frame of the Image Sequence. This last shown frame will be used as the new starting frame for the , which will come next directly after the .

Without using the last shown frame as the new starting frame, the Image Sequence always plays from the beginning (the original starting frame set in the . This is not ideal if the button has been clicked too fast or the mouse has gone in and out of the object area faster than the time it takes for the Image Sequence animation to play through fully. Without this , the animation may jump instead of always smoothly moving through the frames in the correct order.

The last Node in each of the groups is the . While the same Node is used in each group, the are set differently for each event, because a different section and direction of the Image Sequence will be designated for each event.

For the event, we want the button to go from an unpressed button to a half-pressed button. This means that in the of the , we should set the starting frame to be 0 (unpressed state) and the end frame to be 5 (half-pressed state). Since we have 11 total frames in the Image Sequence, frame 5 is half-way through the frames. The PlayDirection should be set to Forward so the frames show in ascending order: (0,1,2,3,4,5).

For the 'On Mouse Exit' group, we trigger the Logic with the . Here, the Image Sequence will show the button returning to the unpressed state from the half-pressed state it is currently in. The same start and end frame from the 'On Mouse Enter' group are used, but this time the PlayDirection is set to Backward so it plays in descending order: (5,4,3,2,1,0).

For the 'On Mouse Down' group, we trigger the Logic with the . Here, the Image Sequence will show the button going to the fully pressed state when the mouse button is pressed down. This time, the starting frame is set to 0 (unpressed state) and the end frame is set to 10 (fully pressed state). The PlayDirection is set to Forward. Remember that the start frame will not actually start at 0 and will always start from the last current frame. Since the mouse must enter the area of the button to click it, the starting frame will likely be set to 5 by the Logic while the project is playing.

For the 'On Mouse Up' group, we trigger the Logic with the . Here, the Image Sequence will show the button going fully back up to the unpressed state when the mouse button is released back up. The starting frame is also set to 0 and the end frame is set to 10, but this time the PlayDirection is set to Backward. Remember that the start frame will not actually reach the last frame of 0 if the mouse is still hovering over the button.

Nodes
Image Sequence Editor
Asset Manager
Image Sequence Editor
Asset Manager
Event Nodes
ImageSequence Nodes
Custom Function Node
Event Nodes
On Mouse Enter
On Mouse Leave
On Mouse Button Down
On Mouse Button Up
Custom Function Node
ImageSequence Nodes
Play ImageSequence
Stop ImageSequence
Get Current ImageSequenceFrame
Event Nodes
On Mouse Enter
On Mouse Leave
On Mouse Button Down
On Mouse Button Up
Event Node
Attributes
Play ImageSequence Node
Custom Function Node
Get Current ImageSequence Frame Node
Stop ImageSequence Node
Stop ImageSequence Node
Play ImageSequence Node
Custom Function Node
Play imageSequence Node
Custom Function
Play ImageSequence Node
Attributes
On Mouse Enter
Attributes
Play ImageSequence Node
On Mouse Leave Event Node
On Mouse Button Down Event Node
On Mouse Button Up Event Node
On Mouse Enter Event Node
Attributes
Scene Outliner
Image Sequence
Pulse
Unpressed state (frame 0).
Half-pressed state (frame 5).
Fully pressed state (frame 10).
Image Sequence Editor.
Root Logic.
Stop Image Sequence Custom Function.
On Mouse Enter.
Play ImageSequence Node Attributes
Play ImageSequence Node for Mouse Leave