-
- All Implemented Interfaces:
-
app.rive.runtime.kotlin.core.PlayableInstance,app.rive.runtime.kotlin.core.RefCount
public final class StateMachineInstance extends NativeObject implements PlayableInstance
The StateMachineInstance is a helper to wrap common operations to play a state machine.
This object has a counterpart in C++, which implements a lot of functionality. The unsafeCppPointer keeps track of this relationship.
Use this to keep track of a state machine's current state and progress, and to help apply changes that the state machine makes to components in an Artboard.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringnameprivate final IntegerlayerCountprivate ViewModelInstanceviewModelInstanceprivate final IntegerinputCountprivate final List<SMIInput>inputsprivate final List<String>inputNamesprivate final List<LayerState>statesChangedprivate final List<RiveEvent>eventsReportedprivate final BooleanhasCppObjectprivate AtomicIntegerrefsprivate LongcppPointerprivate final List<RefCount>dependenciesprivate final IntegerrefCount
-
Constructor Summary
Constructors Constructor Description StateMachineInstance(Long unsafeCppPointer, ReentrantLock lock)
-
Method Summary
Modifier and Type Method Description StringgetName()final IntegergetLayerCount()final ViewModelInstancegetViewModelInstance()The ViewModelInstance assigned to this artboard. final UnitsetViewModelInstance(ViewModelInstance viewModelInstance)final IntegergetInputCount()final List<SMIInput>getInputs()final List<String>getInputNames()final List<LayerState>getStatesChanged()final List<RiveEvent>getEventsReported()final BooleangetHasCppObject()final AtomicIntegergetRefs()final UnitsetRefs(AtomicInteger refs)final LonggetCppPointer()final UnitsetCppPointer(Long cppPointer)final List<RefCount>getDependencies()IntegergetRefCount()UnitcppDelete(Long pointer)final ViewModelInstancereceiveViewModelInstance(ViewModelInstance.Transfer transfer)final Booleanadvance(Float elapsed)Advance the state machine. final <ERROR CLASS>pointerDown(Integer pointerID, Float x, Float y)final <ERROR CLASS>pointerUp(Integer pointerID, Float x, Float y)final <ERROR CLASS>pointerMove(Integer pointerID, Float x, Float y)final <ERROR CLASS>pointerExit(Integer pointerID, Float x, Float y)final SMIInputinput(Integer index)Get the input instance at a given index in the state machine. final SMIInputinput(String name)Get the input with a given name in the state machine. final LayerStatestateChanged(Integer index)Get a specific state changed in the last advance. final RiveEventeventAt(Integer index)Get a specific event fired in the last advance. -
-
Constructor Detail
-
StateMachineInstance
StateMachineInstance(Long unsafeCppPointer, ReentrantLock lock)
-
-
Method Detail
-
getLayerCount
final Integer getLayerCount()
-
getViewModelInstance
final ViewModelInstance getViewModelInstance()
The ViewModelInstance assigned to this artboard. Once assigned, modifications to the. properties of the instance will be reflected in the bindings of this state machine.
Assigning will apply to both the StateMachineInstance and the parent Artboard. Assigning null will do nothing.
-
setViewModelInstance
final Unit setViewModelInstance(ViewModelInstance viewModelInstance)
-
getInputCount
final Integer getInputCount()
-
getInputNames
final List<String> getInputNames()
-
getStatesChanged
final List<LayerState> getStatesChanged()
-
getEventsReported
final List<RiveEvent> getEventsReported()
-
getHasCppObject
final Boolean getHasCppObject()
-
getRefs
final AtomicInteger getRefs()
-
setRefs
final Unit setRefs(AtomicInteger refs)
-
getCppPointer
final Long getCppPointer()
-
setCppPointer
final Unit setCppPointer(Long cppPointer)
-
getDependencies
final List<RefCount> getDependencies()
-
getRefCount
Integer getRefCount()
-
receiveViewModelInstance
final ViewModelInstance receiveViewModelInstance(ViewModelInstance.Transfer transfer)
-
advance
final Boolean advance(Float elapsed)
Advance the state machine.
- Parameters:
elapsed- The time in seconds to advance by.
-
pointerDown
final <ERROR CLASS> pointerDown(Integer pointerID, Float x, Float y)
-
pointerMove
final <ERROR CLASS> pointerMove(Integer pointerID, Float x, Float y)
-
pointerExit
final <ERROR CLASS> pointerExit(Integer pointerID, Float x, Float y)
-
input
final SMIInput input(Integer index)
Get the input instance at a given index in the state machine.
This starts at 0.
-
stateChanged
final LayerState stateChanged(Integer index)
Get a specific state changed in the last advance.
- Parameters:
index- The index of the state.
-
-
-
-