-
- 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
-
-
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 Unit pointerDown(Float x, Float y)
-
pointerMove
final Unit pointerMove(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.
-
-
-
-