-
Notifications
You must be signed in to change notification settings - Fork 40
docs(editor): move inputs, runtime events to legacy features #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f7210f
a2db256
d0971d0
ce0dd00
322fd49
d8ce722
a99e5c2
2695e2a
b4278b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: 'Events at Runtime' | ||
| description: "Using events to communicate with runtime code (deprecated)" | ||
| noindex: true; | ||
| --- | ||
| import { YouTube } from "/snippets/youtube.mdx"; | ||
|
|
||
| <Warning> | ||
| **DEPRECATION NOTICE:** | ||
|
|
||
| [Rive Events](/editor/events/overview) are still fully supported within a Rive file. However, using events to communicate with runtime code is deprecated. | ||
|
|
||
| **For new projects:** Use [Data Binding](/editor/data-binding) instead. | ||
|
|
||
| **This content is provided for legacy support only.** | ||
| </Warning> | ||
|
|
||
| For general information about adding, creating, and signaling events, see [Rive Events](/editor/events/overview). | ||
|
|
||
| <YouTube id="M5DIDVtYI_Y" /> | ||
|
|
||
| General Events were previously used to send signals from a Rive file to runtime code. They allowed designers and developers to coordinate behavior by passing event data at specific moments in an animation. | ||
|
|
||
| This approach has been deprecated in favor of [Data Binding](/editor/data-binding/), which provides a more structured and predictable way to communicate with runtime code. | ||
|
|
||
| ## Properties | ||
|
|
||
| Properties allow you to attach additional data to an Event that can be read by the runtime. | ||
|
|
||
| To add a new property, click the `+` button next to Properties. | ||
|
|
||
|  | ||
|
|
||
| Give your property a clear name, then choose the type of value it represents, which can be a Number, Boolean, or String. | ||
|
|
||
|  | ||
|
|
||
| You can key a property on the timeline to update its value over time. When the Event is reported, the runtime receives the current value of each property. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: 'Open URL Events' | ||
| description: "Using events to open URLs at runtime" | ||
| noindex: true; | ||
| --- | ||
|
|
||
| <Warning> | ||
| Open URL Events are not supported on Apple or Android runtimes. | ||
| </Warning> | ||
|
|
||
| <Note> | ||
| For security reasons, Open URL Events are disabled by default in web runtimes. | ||
|
|
||
| To enable them, set `automaticallyHandleEvents` to `true`. | ||
| </Note> | ||
|
|
||
| <Note> | ||
| For security reasons, Open URL Events are disabled in share links and on the Rive Marketplace. | ||
| </Note> | ||
|
|
||
| For general information about adding, creating, and signaling events, see [Rive Events](/editor/events/overview). | ||
|
|
||
| ### URL Properties | ||
|
|
||
| When you select the **Open URL** Event type, additional configuration options become available. | ||
|
|
||
|  | ||
|
|
||
| Enter the URL you want to open. | ||
|
|
||
| <Info> | ||
| Include the URL protocol (for example, `http://` or `https://`) when linking to external domains. | ||
| </Info> | ||
|
|
||
| The **Target** determines where the URL opens in the browser. | ||
|
|
||
| - `Blank` — Opens the link in a new tab or window, depending on browser settings. | ||
| **Note:** If the Event is not triggered by a user interaction (for example, via a Listener), the browser may block it as a popup. | ||
| - `Parent` — Opens in the parent browsing context. If no parent exists, behaves like `Self`. | ||
| - `Self` — Opens in the current browsing context. | ||
| - `Top` — Opens in the topmost browsing context. If no ancestor exists, behaves like `Self`. | ||
|
|
||
| <Info> | ||
| For security reasons, URLs are not opened by default in embeds or Marketplace posts. This behavior may change in the future. | ||
| </Info> | ||
|
|
||
| ### Properties (Deprecated) | ||
|
|
||
| Properties allow an Event to carry additional data to the runtime. | ||
|
|
||
| This feature is deprecated and has been replaced by [Data Binding](/editor/data-binding). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,109 +1,71 @@ | ||
| --- | ||
| title: 'Events Overview' | ||
| sidebarTitle: 'Overview' | ||
| description: "⚠️ DEPRECATED: Use Data Binding instead of Events" | ||
| description: "Creating and signaling Rive Events" | ||
| --- | ||
| import { YouTube } from "/snippets/youtube.mdx"; | ||
|
|
||
| <Warning> | ||
| **DEPRECATION NOTICE:** This entire page documents the legacy Events system. | ||
| **For new projects:** Use [Data Binding](/runtimes/data-binding) instead. | ||
| **For existing projects:** Plan to migrate from Events to Data Binding as soon | ||
| as possible. **This content is provided for legacy support only.** | ||
| </Warning> | ||
|
Comment on lines
-8
to
-13
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't true. Events are still valid, just not for communicating with the runtime code. |
||
| Events live within an artboard and are used to signal that something has happened. They can be fired from timelines, states, transitions, or listeners. | ||
|
|
||
| Rive supports three types of events: | ||
|
|
||
| <YouTube id="M5DIDVtYI_Y" /> | ||
|
|
||
| Events are a way to send signals to your runtime code to execute a block of code at the right moment. They enhance the communication between designers and developers by passing along useful information. With them, we can do things like go to a URL, play a sound, have some HTML appear, or do anything else we may want to accomplish via code. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this, we no longer have a high level explanation of what events are good for. We now jump straight to "Creating an Event". With events not being deprecated on the editor side (which I don't fully understand - why can't data binding do all of what they can?), we should provide a new explanation for their purpose.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's really only one remaining use. You can't key a view model property or trigger, but you can key an event which can affect vm props. It's kind of roundabout. :/ |
||
|
|
||
| Coordinating Rive events at design time and runtime will be important to ensure a successful integration in apps, games, and more. | ||
| - [Open URL Event](/editor/events/open-url-events) — Opens a URL at runtime | ||
| - [Audio Event](/editor/events/audio-events) — Plays a sound | ||
| - [General Event (deprecated)](/editor/events/general-events) — Previously used to communicate with runtime code | ||
|
|
||
| ## Creating an Event | ||
|
|
||
| To create an Event, use the Events tool located in the Toolbar. Once the tool is active, click anywhere on the artboard to add a new event. | ||
|
|
||
|  | ||
|
|
||
| You'll notice that the Event is displayed on the artboard and in the Hierarchy. | ||
|
|
||
| ## Configuring an Event | ||
|
|
||
| Once we've added an event, we need to configure the Event using the Inspector. | ||
|
|
||
|  | ||
|
|
||
| ### Name | ||
|
|
||
| The Name field is where we can give our Event a specific name. It's important to do this so that at runtime, we can hook up the correct bits of code to their corresponding events. | ||
|
|
||
|  | ||
|
|
||
| You can also rename the Event directly on the artboard. | ||
|
|
||
| ### Type | ||
| <Steps> | ||
| <Step title="Create an Event"> | ||
| Use the Events tool located in the toolbar and click anywhere on the artboard. | ||
|
|
||
| The Type dropdown allows you to change the Event type between General and URL. | ||
|  | ||
|
|
||
|  | ||
| You'll notice that the event is displayed on the artboard and in the Hierarchy. | ||
| </Step> | ||
| <Step title="Name your Event"> | ||
| Give your event a name so it’s easy to identify and reference. | ||
|
|
||
| ### Properties | ||
| You can rename it using the **Name** field, or by double-clicking the name directly on the artboard. | ||
|
|
||
| Properties allow us to define extra information being passed to the Runtimes. For example, you may want to pass in the name of an audio file to play when the event is reported at runtime, or perhaps some other metadata for data analytics purposes. | ||
|  | ||
| </Step> | ||
| <Step title="Select an Event type"> | ||
| The Type dropdown allows you to change the event type between Audio, URL, and General. | ||
|
|
||
| To add a new property, hit the plus button next to the Properties. | ||
|  | ||
| </Step> | ||
| <Step title="Set your Event Properties"> | ||
| Each event type has its own set of properties. | ||
|
|
||
|  | ||
| For more information on the specific event types, see [Open URL Events](/editor/events/open-url-events), [Audio Events](/editor/events/audio-events), and [General Events (deprecated)](/editor/events/general-events). | ||
| </Step> | ||
| </Steps> | ||
|
|
||
| First, we want to change the name of our property to something identifiable. Next, we need to select what type of value our property will track such as a Number, Boolean, or String. | ||
|
|
||
|  | ||
|
|
||
| ### URL | ||
|
|
||
| When an `Open URL` Event is selected, we have additional configuration options. | ||
|
|
||
| Properties for Open URL Event | ||
|
|
||
|  | ||
|
|
||
| In the text box, we will add the URL that we want our component to take us. | ||
|
|
||
| <Info>Make sure to include the URL Protocol (i.e. "http://" or "https://") if you want to link to a new domain.</Info> | ||
|
|
||
| The Target tells the user's browser where this URL should open. We have a few options: Blank, Parent, Self, and Top. | ||
|
|
||
| - `Blank` - Usually opens the link in a new tab, but users can configure browsers to open a new window instead. **Note:** if the Event is not signaled from a Rive Listener, the browser may block and notify the user a popup was blocked | ||
| - `Parent` - Opens in the parent browsing context of the current one. If no parent, behaves as `Self`. | ||
| - Self - Opens in the current browsing context | ||
| - Top - Opens in the topmost browsing context (the "highest" context that's an ancestor of the current one). If no ancestors, behaves as `Self`. | ||
|
|
||
| <Info>At this time, by default, Rive will not open URLs when this type of event is reported in embed URLs or Marketplace posts due to security considerations. However, this may change in the future</Info> | ||
|
|
||
| ## Signaling an Event | ||
|
|
||
| We can signal an event in three ways: via the timeline, on a state, or on a transition. | ||
| We can signal an event in four ways: from a timeline, a listener, a state, or a transition. | ||
|
|
||
| ### Timeline | ||
|
|
||
| Signaling an event through the timeline allows us to control the precise moment a piece of code will fire, like a sound effect. | ||
| Signaling an event from the timeline lets you control the exact moment in an animation when the event fires. | ||
|
|
||
| First, select the timeline you want to add the event to. Next, use the Report Event button in the inspector. Note that this key will be placed at the location of the playhead. | ||
| First, select the timeline you want to add the event to. Then use the **Report Event** button in the Inspector. | ||
|
|
||
|  | ||
|
|
||
| Additionally, you can key a property to let the runtimes know that a particular boolean, number, or string property has a new value. | ||
|
|
||
| ### Transition & State | ||
|
|
||
| You can report an event on a Transition or a State. We typically do this to signal at runtime contextual information about what is happening in the State Machine. For example, if we want to have some element appear at the end of our Transition, we would want to use an event tied to a Transition to signal this. | ||
| You can report an event on a transition or a state. To report an event, select the desired state or transition and use the `+` button next to the Events section in the Inspector. | ||
|
|
||
|
|
||
| To report an event, select either the desired State or Transition and use the plus button next to the Events section in the Inspector. | ||
|  | ||
|
|
||
|  | ||
| Now that we've selected the event, we can decide whether it is signaled at the start or end of the transition or state. | ||
|
|
||
| The dropdown allows us to select any Event we've defined. Now that we've selected the Event, we can decide whether it is signaled at the start or end of the Transition or State. | ||
| ### Listeners | ||
|
|
||
| ## Events at Runtime | ||
| With your [Listener](/editor/state-machine/listeners) selected, click the `+` below the State Machine Graph, and select **Report Event**. | ||
|
|
||
| Listening for events at runtime is deprecated. Use [Data Binding](/editor/data-binding) instead. | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a note, this functionality was never added to the command queue, and so we have no way of responding to them. We need to consider as a team whether we want this functionality. Is it a security risk to allow Rive files to open arbitrary URLs? What if they point a user to a compromised website or a phishing scam?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was always more of a convenience as well. Developers could still react to a data binding event and open a browser using whatever native APIs are available to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'm adding a warning about Apple/Android, but I can definitely see getting rid of these altogether.
They tend to confuse people at runtime because they're disabled by default and aren't supported in the marketplace or share links. You need to set property to make them work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 big new warnings that scream "maybe don't use this". 😂