-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.TextureView.SurfaceTextureListener,android.view.accessibility.AccessibilityEventSource,app.rive.runtime.kotlin.Observable
public class RiveAnimationView extends RiveTextureView implements Observable<RiveFileController.Listener>
This view aims to provide the most straightforward way to get Rive graphics into your application.
Simply add the view to your activity and you are good to go!
Very simple animations can be configured completely from a layout file. We also expose a thin API layer to allow more control over how animations are played.
All of this is built upon the C++ wrappers under the
app.rive.runtime.kotlin.corenamespace which can be used directly for the most flexibility.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classRiveAnimationView.Companionpublic final classRiveAnimationView.RendererAttributesTracks the renderer attributes that need to be applied to this View within its lifecycle.
public final classRiveAnimationView.Builder
-
Field Summary
Fields Modifier and Type Field Description private final BooleandefaultAutoplayprivate RiveFileControllercontrollerprivate final RiveArtboardRendererartboardRendererprivate final RiveAnimationView.RendererAttributesrendererAttributesprivate Fitfitprivate Alignmentalignmentprivate FloatlayoutScaleFactorprivate FloatlayoutScaleFactorAutomaticprivate final Filefileprivate StringartboardNameprivate Booleanautoplayprivate final List<LinearAnimationInstance>animationsprivate final List<StateMachineInstance>stateMachinesprivate final <ERROR CLASS><LinearAnimationInstance>playingAnimationsprivate final <ERROR CLASS><StateMachineInstance>playingStateMachinesprivate BooleantouchPassThroughprivate BooleanmultiTouchEnabledprivate final BooleanisPlaying
-
Constructor Summary
Constructors Constructor Description RiveAnimationView(RiveAnimationView.Builder builder)RiveAnimationView(Context context, AttributeSet attrs)
-
Method Summary
Modifier and Type Method Description BooleangetDefaultAutoplay()final RiveFileControllergetController()final UnitsetController(RiveFileController controller)final RiveArtboardRenderergetArtboardRenderer()final RiveAnimationView.RendererAttributesgetRendererAttributes()final FitgetFit()final UnitsetFit(Fit fit)final AlignmentgetAlignment()final UnitsetAlignment(Alignment alignment)final FloatgetLayoutScaleFactor()final UnitsetLayoutScaleFactor(Float layoutScaleFactor)final FloatgetLayoutScaleFactorAutomatic()final UnitsetLayoutScaleFactorAutomatic(Float layoutScaleFactorAutomatic)final FilegetFile()final StringgetArtboardName()final UnitsetArtboardName(String artboardName)final BooleangetAutoplay()final UnitsetAutoplay(Boolean autoplay)final List<LinearAnimationInstance>getAnimations()final List<StateMachineInstance>getStateMachines()final <ERROR CLASS><LinearAnimationInstance>getPlayingAnimations()final <ERROR CLASS><StateMachineInstance>getPlayingStateMachines()BooleangetTouchPassThrough()Whether the view should absorb touch events. UnitsetTouchPassThrough(Boolean touchPassThrough)Whether the view should absorb touch events. BooleangetMultiTouchEnabled()Whether multitouch is enabled. UnitsetMultiTouchEnabled(Boolean multiTouchEnabled)final BooleangetIsPlaying()UnitonSurfaceTextureSizeChanged(SurfaceTexture surface, Integer width, Integer height)UnitonSurfaceTextureAvailable(SurfaceTexture surfaceTexture, Integer width, Integer height)final Unitpause()Pauses all playing animation instances. final Unitpause(List<String> animationNames, Boolean areStateMachines)Pauses any animation instances with any of the provided names. final Unitpause(String animationName, Boolean isStateMachine)Pauses any animation instances called animationName. final Unitstop()Stops all animation instances. final Unitstop(List<String> animationNames, Boolean areStateMachines)Stops any animation instances with any of the provided names. final Unitstop(String animationName, Boolean isStateMachine)Stops any animation instances called animationName. final Unitplay(Loop loop, Direction direction, Boolean settleInitialState)Restarts paused animations. final Unitplay(List<String> animationNames, Loop loop, Direction direction, Boolean areStateMachines, Boolean settleInitialState)Plays any animation instances with any of the provided names. final Unitplay(String animationName, Loop loop, Direction direction, Boolean isStateMachine, Boolean settleInitialState)Plays any animation instances called animationName. final Unitreset()Reset the view by resetting the current artboard before any animations have been applied. final UnitfireState(String stateMachineName, String inputName)Fire an SMITrigger input. final UnitsetBooleanState(String stateMachineName, String inputName, Boolean value)Update the state of an SMIBoolean input. final UnitsetNumberState(String stateMachineName, String inputName, Float value)Update the state of an SMINumber input. final UnitfireStateAtPath(String inputName, String path)Fire an SMITrigger input. final UnitsetBooleanStateAtPath(String inputName, Boolean value, String path)Update the state of an SMIBoolean input. final UnitsetNumberStateAtPath(String inputName, Float value, String path)Update the state of an SMINumber input. final UnitsetMultipleStates(ChangedInput inputs)Update multiple states at once supplying one or more inputs. final StringgetTextRunValue(String textRunName)Get the current value for a text run named textRunName on the active artboard if it exists. final StringgetTextRunValue(String textRunName, String path)Get the text value for a text run named textRunName on the nested artboard represented at path. final UnitsetTextRunValue(String textRunName, String textValue)Set the text value for a text run named textRunName to textValue on the active artboard. final UnitsetTextRunValue(String textRunName, String textValue, String path)Set the text value for a text run named textRunName to textValue on the nested artboard represented at path. final FloatgetVolume()Get the active Artboard's volume. final UnitsetVolume(Float value)Set the active Artboard's volume to value. final UnitsetRiveResource(@RawRes() Integer resId, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)Load the resource ID as a Rive file into the view. final UnitsetRiveBytes(ByteArray bytes, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)Create a Rive file from a byte array and load it into the view. final UnitsetRiveFile(File file, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)Set this view to use the specified Rive file. final UnitsetAssetLoader(FileAssetLoader assetLoader)Overrides the current asset loader. final ControllerStatesaveControllerState()final UnitrestoreControllerState(ControllerState state)UnitregisterListener(RiveFileController.Listener listener)UnitunregisterListener(RiveFileController.Listener listener)final UnitaddEventListener(RiveFileController.RiveEventListener listener)Adds a RiveEventListener to get notified on RiveEvents. final UnitremoveEventListener(RiveFileController.RiveEventListener listener)Removes the listener. BooleanonTouchEvent(MotionEvent event)-
Methods inherited from class app.rive.runtime.kotlin.RiveAnimationView
onSurfaceTextureDestroyed, onSurfaceTextureUpdated -
Methods inherited from class android.view.TextureView
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearFocus, clearPendingCredentialRequest, clearViewTranslationCallback, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableHotspotChanged, drawableStateChanged, findFocus, findOnBackInvokedDispatcher, findViewById, findViewWithTag, findViewsWithText, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, gatherTransparentRegion, generateDisplayHash, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContentSensitivity, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getFrameContentVelocity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegateFlags, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPendingCredentialCallback, getPendingCredentialRequest, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getRequestedFrameRate, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSupplementalDescription, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasTransientState, hasWindowFocus, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContentSensitive, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, jumpDrawablesToCurrentState, keyboardNavigationClusterSearch, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onResolvePointerIcon, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, reportAppJankStats, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContentSensitivity, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setFrameContentVelocity, setHandwritingBoundsOffsets, setHandwritingDelegateFlags, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPendingCredentialRequest, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRequestedFrameRate, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSupplementalDescription, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setWindowInsetsAnimationCallback, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw -
Methods inherited from class app.rive.runtime.kotlin.RiveTextureView
buildLayer, draw, getAccessibilityClassName, getBitmap, getBitmap, getBitmap, getLayerType, getSurfaceTexture, getSurfaceTextureListener, getTransform, isAvailable, isOpaque, lockCanvas, lockCanvas, onDraw, onSizeChanged, setBackgroundDrawable, setForeground, setLayerPaint, setLayerType, setOpaque, setSurfaceTexture, setSurfaceTextureListener, setTransform, unlockCanvasAndPost -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
RiveAnimationView
RiveAnimationView(RiveAnimationView.Builder builder)
-
RiveAnimationView
RiveAnimationView(Context context, AttributeSet attrs)
-
-
Method Detail
-
getDefaultAutoplay
Boolean getDefaultAutoplay()
-
getController
final RiveFileController getController()
-
setController
final Unit setController(RiveFileController controller)
-
getArtboardRenderer
final RiveArtboardRenderer getArtboardRenderer()
-
getRendererAttributes
final RiveAnimationView.RendererAttributes getRendererAttributes()
-
getAlignment
final Alignment getAlignment()
-
setAlignment
final Unit setAlignment(Alignment alignment)
-
getLayoutScaleFactor
final Float getLayoutScaleFactor()
-
setLayoutScaleFactor
final Unit setLayoutScaleFactor(Float layoutScaleFactor)
-
getLayoutScaleFactorAutomatic
final Float getLayoutScaleFactorAutomatic()
-
setLayoutScaleFactorAutomatic
final Unit setLayoutScaleFactorAutomatic(Float layoutScaleFactorAutomatic)
-
getArtboardName
final String getArtboardName()
-
setArtboardName
final Unit setArtboardName(String artboardName)
-
getAutoplay
final Boolean getAutoplay()
-
setAutoplay
final Unit setAutoplay(Boolean autoplay)
-
getAnimations
final List<LinearAnimationInstance> getAnimations()
-
getStateMachines
final List<StateMachineInstance> getStateMachines()
-
getPlayingAnimations
final <ERROR CLASS><LinearAnimationInstance> getPlayingAnimations()
-
getPlayingStateMachines
final <ERROR CLASS><StateMachineInstance> getPlayingStateMachines()
-
getTouchPassThrough
Boolean getTouchPassThrough()
Whether the view should absorb touch events. By default the view will not allow any touch events to views behind it. Set to
trueto allow for this behavior.
-
setTouchPassThrough
Unit setTouchPassThrough(Boolean touchPassThrough)
Whether the view should absorb touch events. By default the view will not allow any touch events to views behind it. Set to
trueto allow for this behavior.
-
getMultiTouchEnabled
Boolean getMultiTouchEnabled()
Whether multitouch is enabled. When false, only the primary pointer (index 0) will be processed; additional fingers will be ignored.
If set to false while multiple pointers are down, pointer up/exit events will be synthesized for all non-primary pointers to notify Rive that those pointers are no longer active.
-
setMultiTouchEnabled
Unit setMultiTouchEnabled(Boolean multiTouchEnabled)
-
getIsPlaying
final Boolean getIsPlaying()
-
onSurfaceTextureSizeChanged
Unit onSurfaceTextureSizeChanged(SurfaceTexture surface, Integer width, Integer height)
-
onSurfaceTextureAvailable
Unit onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, Integer width, Integer height)
-
pause
final Unit pause()
Pauses all playing animation instances.
-
pause
final Unit pause(List<String> animationNames, Boolean areStateMachines)
Pauses any animation instances with any of the provided names.
Advanced: Multiple animation instances can be running the same animationNames.
-
pause
final Unit pause(String animationName, Boolean isStateMachine)
Pauses any animation instances called animationName.
Advanced: Multiple animation instances can be running the same animationName Animation.
-
stop
final Unit stop()
Stops all animation instances.
Animations instances will be disposed of completely. Subsequent plays will create new animation instances for the animation in the file.
-
stop
final Unit stop(List<String> animationNames, Boolean areStateMachines)
Stops any animation instances with any of the provided names.
Animations instances will be disposed of completely. Subsequent plays will create new animation instances for the animations in the file.
Advanced: Multiple animation instances can run the same animation.
-
stop
final Unit stop(String animationName, Boolean isStateMachine)
Stops any animation instances called animationName.
Animations instances will be disposed of completely. Subsequent plays will create new animation instances.
Advanced: Multiple animation instances can run the same animation.
-
play
final Unit play(Loop loop, Direction direction, Boolean settleInitialState)
Restarts paused animations. If no animations were playing it plays the first in the File.
-
play
final Unit play(List<String> animationNames, Loop loop, Direction direction, Boolean areStateMachines, Boolean settleInitialState)
Plays any animation instances with any of the provided names.
-
play
final Unit play(String animationName, Loop loop, Direction direction, Boolean isStateMachine, Boolean settleInitialState)
Plays any animation instances called animationName.
-
reset
final Unit reset()
Reset the view by resetting the current artboard before any animations have been applied.
Note: This will respect autoplay.
-
fireState
final Unit fireState(String stateMachineName, String inputName)
Fire an SMITrigger input.
- Parameters:
stateMachineName- The state machine name.inputName- The trigger input name.
-
setBooleanState
final Unit setBooleanState(String stateMachineName, String inputName, Boolean value)
Update the state of an SMIBoolean input.
- Parameters:
stateMachineName- The state machine name.inputName- The boolean input name.value- The new value.
-
setNumberState
final Unit setNumberState(String stateMachineName, String inputName, Float value)
Update the state of an SMINumber input.
- Parameters:
stateMachineName- The state machine name.inputName- The number input name.value- The new value.
-
fireStateAtPath
final Unit fireStateAtPath(String inputName, String path)
Fire an SMITrigger input.
- Parameters:
inputName- The trigger name.path- The path to the nested artboard.
-
setBooleanStateAtPath
final Unit setBooleanStateAtPath(String inputName, Boolean value, String path)
Update the state of an SMIBoolean input.
- Parameters:
inputName- The boolean input name.value- The new value.path- The path to the nested artboard.
-
setNumberStateAtPath
final Unit setNumberStateAtPath(String inputName, Float value, String path)
Update the state of an SMINumber input.
- Parameters:
inputName- The number input name.value- The new value.path- The path to the nested artboard.
-
setMultipleStates
final Unit setMultipleStates(ChangedInput inputs)
Update multiple states at once supplying one or more inputs.
-
getTextRunValue
final String getTextRunValue(String textRunName)
Get the current value for a text run named textRunName on the active artboard if it exists.
-
getTextRunValue
final String getTextRunValue(String textRunName, String path)
Get the text value for a text run named textRunName on the nested artboard represented at path.
-
setTextRunValue
final Unit setTextRunValue(String textRunName, String textValue)
Set the text value for a text run named textRunName to textValue on the active artboard.
-
setTextRunValue
final Unit setTextRunValue(String textRunName, String textValue, String path)
Set the text value for a text run named textRunName to textValue on the nested artboard represented at path.
-
setRiveResource
final Unit setRiveResource(@RawRes() Integer resId, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)
Load the resource ID as a Rive file into the view.
- Parameters:
resId- The resource ID to load.artboardName- Optionally provide an named artboard to use.animationName- Optionally provide an named animation to load.stateMachineName- Optionally provide a named state machine to load.autoplay- Enable autoplay to start the animation automatically.fit- Configure how the animation should be resized to fit its container.alignment- Configure how the animation should be aligned to its container.loop- Configure if animations should loop, play once, or ping-pong back and forth.
-
setRiveBytes
final Unit setRiveBytes(ByteArray bytes, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)
Create a Rive file from a byte array and load it into the view.
- Parameters:
bytes- The byte array to load as a Rive file.
-
setRiveFile
final Unit setRiveFile(File file, String artboardName, String animationName, String stateMachineName, Boolean autoplay, Boolean autoBind, Fit fit, Alignment alignment, Loop loop)
Set this view to use the specified Rive file. The file must be initialized outside this scope and the caller is responsible for cleaning up its resources.
- Parameters:
file- The Rive file to load.
-
setAssetLoader
final Unit setAssetLoader(FileAssetLoader assetLoader)
Overrides the current asset loader. It increases the assetLoader ref count by one, but its ownership is still in the hands of the caller.
A RiveAnimationView creates a FallbackAssetLoader by default.
-
saveControllerState
final ControllerState saveControllerState()
-
restoreControllerState
final Unit restoreControllerState(ControllerState state)
-
registerListener
Unit registerListener(RiveFileController.Listener listener)
-
unregisterListener
Unit unregisterListener(RiveFileController.Listener listener)
-
addEventListener
final Unit addEventListener(RiveFileController.RiveEventListener listener)
Adds a RiveEventListener to get notified on RiveEvents.
Remove with: removeEventListener.
-
removeEventListener
final Unit removeEventListener(RiveFileController.RiveEventListener listener)
Removes the listener.
-
onTouchEvent
Boolean onTouchEvent(MotionEvent event)
-
-
-
-