Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rive-app/canvas

Package Overview
Dependencies
Maintainers
5
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rive-app/canvas

Rive's canvas based web api.

  • 2.25.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
177K
decreased by-10.3%
Maintainers
5
Weekly downloads
 
Created

What is @rive-app/canvas?

@rive-app/canvas is an npm package that allows developers to integrate Rive animations into their web applications using the HTML5 canvas element. Rive is a powerful tool for creating interactive animations and graphics, and this package provides the necessary tools to render and control these animations within a web environment.

What are @rive-app/canvas's main functionalities?

Loading and Rendering Animations

This feature allows you to load and render a Rive animation onto an HTML5 canvas element. The 'src' attribute specifies the path to the .riv file, and 'autoplay' determines whether the animation should start playing automatically.

const rive = new Rive({
  src: 'path/to/animation.riv',
  canvas: document.getElementById('canvas'),
  autoplay: true
});

Controlling Animations

This feature provides methods to control the playback of the animation. You can play, pause, and stop the animation programmatically.

const animation = new Rive({
  src: 'path/to/animation.riv',
  canvas: document.getElementById('canvas'),
  autoplay: false
});

// Play the animation
animation.play();

// Pause the animation
animation.pause();

// Stop the animation
animation.stop();

Interactivity

This feature allows you to interact with the animation by triggering inputs in the state machine. This can be used to create interactive animations that respond to user input.

const rive = new Rive({
  src: 'path/to/animation.riv',
  canvas: document.getElementById('canvas'),
  autoplay: true,
  stateMachines: 'StateMachineName'
});

// Trigger an input in the state machine
rive.stateMachineInputs('StateMachineName').find(input => input.name === 'inputName').fire();

Other packages similar to @rive-app/canvas

Keywords

FAQs

Package last updated on 11 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc