Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/src/components/DataBinding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DataBinding = () => {
const { rive, RiveComponent } = useRive({
src: 'stocks.riv',
artboard: 'Main',
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
autoBind: false,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/DataBindingHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const CURRENCY_PROP = 'currency';
const GlobalViewModelInstance = () => {
const { rive, RiveComponent } = useRive({
src: 'global_variables_test.riv',
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: false,
autoBind: false,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/DataBindingPreRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CURRENCY_PROP = 'currency';
const GlobalViewModels = () => {
const { RiveComponent } = useRive({
src: 'global_variables_test.riv',
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
// set autoBind to false to set up main+global instances before first frame manually
autoBind: false,
Expand Down
26 changes: 13 additions & 13 deletions examples/src/components/DataBindingTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const StringPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: name, setValue: setName } = useViewModelInstanceString('name', rive?.viewModelInstance);
Expand Down Expand Up @@ -59,7 +59,7 @@ export const NumberPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: age, setValue: setAge } = useViewModelInstanceNumber('age', rive?.viewModelInstance);
Expand Down Expand Up @@ -93,7 +93,7 @@ export const BooleanPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: agreedToTerms, setValue: setAgreedToTerms } = useViewModelInstanceBoolean('agreedToTerms', rive?.viewModelInstance);
Expand Down Expand Up @@ -138,7 +138,7 @@ export const ColorPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});


Expand Down Expand Up @@ -191,7 +191,7 @@ export const EnumPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: country, setValue: setCountry, values: countries } = useViewModelInstanceEnum('country', rive?.viewModelInstance);
Expand Down Expand Up @@ -226,7 +226,7 @@ export const NestedViewModelTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: drinkType, setValue: setDrinkType, values: drinkTypes } = useViewModelInstanceEnum('favDrink/type', rive?.viewModelInstance);
Expand Down Expand Up @@ -263,7 +263,7 @@ export const TriggerPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
autoBind: true,
artboard: "Artboard",
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});


Expand Down Expand Up @@ -315,7 +315,7 @@ export const PersonForm = ({ src }: { src: string }) => {
autoplay: true,
autoBind: true,
artboard: "Artboard",
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { value: name, setValue: setName } = useViewModelInstanceString('name', rive?.viewModelInstance);
Expand Down Expand Up @@ -469,7 +469,7 @@ export const PersonInstances = ({ src }: { src: string }) => {
src,
autoplay: true,
artboard: "Artboard",
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const viewModel = useViewModel(rive, { name: 'PersonViewModel' });
Expand Down Expand Up @@ -537,7 +537,7 @@ export const ImagePropertyTest = ({ src }: { src: string }) => {
const { rive, RiveComponent } = useRive({
src,
artboard: "Artboard",
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
autoplay: true,
autoBind: false,
});
Expand Down Expand Up @@ -636,7 +636,7 @@ export const FontPropertyTest = ({ src }: { src: string }) => {

const { rive, RiveComponent } = useRive({
src,
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
autoBind: true,
});
Expand Down Expand Up @@ -767,7 +767,7 @@ export const TodoListTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Artboard",
autoBind: false,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const viewModel = useViewModel(rive, { name: 'TodoList' });
Expand Down Expand Up @@ -896,7 +896,7 @@ export const ArtboardPropertyTest = ({ src }: { src: string }) => {
autoplay: true,
artboard: "Main",
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
});

const { setValue: setArtboard1 } = useViewModelInstanceArtboard('artboard_1', rive?.viewModelInstance);
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRive, EventType, RiveEventType } from '@rive-app/react-canvas';
const Events = () => {
const { rive, RiveComponent } = useRive({
src: 'rating.riv',
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
automaticallyHandleEvents: true,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/FallbackFonts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const FallbackFonts = () => {
src: "fallback-fonts-3.riv",
autoplay: true,
autoBind: true,
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
layout: new Layout({
fit: Fit.Contain,
alignment: Alignment.Center,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/Http.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRive } from '@rive-app/react-canvas';
const Http = () => {
const { RiveComponent } = useRive({
src: 'https://cdn.rive.app/animations/vehicles.riv',
stateMachines: 'bumpy',
stateMachine: 'bumpy',
autoplay: true,
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/ResponsiveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ResponsiveLayout = () => {
const { RiveComponent } = useRive({
src: 'layout_test.riv',
artboard: 'Artboard',
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
layout: new Layout({
fit: Fit.Layout,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/Scripting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ScriptedEffect = () => {
const { RiveComponent } = useRive({
src: 'scripted-path-effect.riv',
artboard: 'Multishape',
stateMachines: "State Machine 1",
stateMachine: "State Machine 1",
autoplay: true,
});

Expand Down
2 changes: 1 addition & 1 deletion examples/src/components/Semantics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const RiveStage = ({ source, label, fit, scale, onLog }: RiveStageProps) => {

const { rive, RiveComponent } = useRive({
...source,
stateMachines: 'State Machine 1',
stateMachine: 'State Machine 1',
autoplay: true,
autoBind: true,
layout,
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
},
"homepage": "https://github.com/rive-app/rive-react#readme",
"dependencies": {
"@rive-app/canvas": "2.40.1",
"@rive-app/canvas-lite": "2.40.1",
"@rive-app/webgl2": "2.40.1"
"@rive-app/canvas": "2.41.0",
"@rive-app/canvas-lite": "2.41.0",
"@rive-app/webgl2": "2.41.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0"
Expand Down
20 changes: 20 additions & 0 deletions src/components/Rive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@ export interface RiveProps {
* Defaults to the first artboard created.
*/
artboard?: string;
/**
* Name of the state machine to play.
*/
stateMachine?: string;
/**
* Specify a starting animation to play.
*
* @deprecated Use the `stateMachine` prop to play a state machine instead.
* Support for starting playback with named animations will be removed in a
* future major version. See
* {@link https://rive.app/docs/editor/state-machine/state-machine} for more on
* setting up state machines in your Rive file.
*/
animations?: string | string[];
/**
* Specify a starting state machine to play.
*
* @deprecated Use `stateMachine` with a single state machine name instead.
* Support for playing multiple state machines at once will be removed in a
* future major version.
*/
stateMachines?: string | string[];
/**
Expand Down Expand Up @@ -46,13 +60,18 @@ export interface RiveProps {
* This flag is false by default to prevent any unwanted behaviors from taking place.
* This means any special Rive Event will have to be handled manually by subscribing to
* EventType.RiveEvent
*
* @deprecated Rive Events are deprecated and will be removed in a future
* major version: please use data binding instead. See
* {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
*/
automaticallyHandleEvents?: boolean;
}

const Rive = ({
src,
artboard,
stateMachine,
animations,
stateMachines,
layout,
Expand All @@ -66,6 +85,7 @@ const Rive = ({
const params = {
src,
artboard,
stateMachine,
animations,
layout,
stateMachines,
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/useStateMachineInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { EventType, Rive, StateMachineInput } from '@rive-app/canvas';
/**
* Custom hook for fetching a stateMachine input from a rive file.
*
* @deprecated State machine inputs are deprecated and will be removed in a
* future major version: please use data binding properties instead. See
* {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
* for how to migrate.
*
* @param rive - Rive instance
* @param stateMachineName - Name of the state machine
* @param inputName - Name of the input
Expand Down
Loading