Skip to content
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

Preloading local rive assets #260

Open
kgni opened this issue Jul 22, 2024 · 2 comments
Open

Preloading local rive assets #260

kgni opened this issue Jul 22, 2024 · 2 comments

Comments

@kgni
Copy link

kgni commented Jul 22, 2024

Hi there!

Has anyone implemented local rive assets preloading? I'm facing an issue where the rive asset is not loaded and cached until it has been ran one time, which causes a minor glitch (see video).

Essentially I just want to preload/cache the rive assets when the app starts - or for more granularity when the user visits a specific route.

I'm using Expo with the expo-custom-assets plugin to load the rive assets.

Sorry if this has already been asked/answered, I couldn't find anything when looking through the issues.

CleanShot.2024-07-22.at.11.47.09.mp4
@kgni
Copy link
Author

kgni commented Jul 22, 2024

The rive animation is supposed to fade in, but since it is not completely loaded before the animation starts playing, it just appears instantly.

@MikeDevBeddo
Copy link

MikeDevBeddo commented Oct 4, 2024

I found workaround, for preloading asset for Rive I make a mount at App.tsx level of the desired animation for some seconds (In my case I remove the animation when bootsplash closes).
If you've found a more elegant way to solve this problem, I'd be happy to see it here)

<>
  <Router />
  {
    /* Workaround to preload Rive source file */
    riveShown && (
      <>
        <Rive
          fit={Fit.Fill}
          resourceName="your_asset"
          style={Styles.flatten([
            StyleSheet.absoluteFillObject,
            {
              left: 10000,
              right: -10000,
              zIndex: -1,
            },
          ])}
        />
      </>
    )
  }
</>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants