
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@stevysmith/rive-generator
Advanced tools
Generate .riv files programmatically with TypeScript.
npm install @stevysmith/rive-generator
import { writeFileSync } from 'fs';
import { RiveFile, hex, PropertyKey } from '@stevysmith/rive-generator';
// Create a new Rive file
const riv = new RiveFile();
// Add an artboard
const artboard = riv.addArtboard({
name: 'My Animation',
width: 400,
height: 400,
});
// Add a shape
const shape = riv.addShape(artboard, {
name: 'Circle',
x: 200,
y: 200,
});
// Add an ellipse path
riv.addEllipse(shape, { width: 100, height: 100 });
// Add a fill with color
const fill = riv.addFill(shape);
riv.addSolidColor(fill, hex('#3498db'));
// Export to .riv file
writeFileSync('output.riv', riv.export());
Main class for building .riv files.
| Method | Description |
|---|---|
addArtboard(options) | Add an artboard (canvas) |
addNode(parent, options) | Add a transform group |
addShape(parent, options) | Add a shape container |
| Method | Description |
|---|---|
addEllipse(shape, options) | Add an ellipse/circle |
addRectangle(shape, options) | Add a rectangle |
addPointsPath(shape, options) | Add a custom vector path |
addVertex(path, options) | Add a straight vertex to path |
| Method | Description |
|---|---|
addFill(shape, options) | Add a fill |
addStroke(shape, options) | Add a stroke |
addSolidColor(paint, color) | Set solid color |
addLinearGradient(paint, options) | Add linear gradient |
addRadialGradient(paint, options) | Add radial gradient |
addGradientStop(gradient, options) | Add gradient color stop |
| Method | Description |
|---|---|
addLinearAnimation(artboard, options) | Add an animation |
addKeyedObject(animation, targetId) | Link animation to object |
addKeyedProperty(keyedObject, propertyKey) | Specify property to animate |
addKeyFrameDouble(keyedProperty, options) | Add a keyframe |
| Method | Description |
|---|---|
export() | Returns Uint8Array of .riv binary |
import { hex, rgba } from '@stevysmith/rive-generator';
hex('#ff0000') // Red
hex('#3498db') // Blue
rgba(255, 0, 0, 255) // Red with full opacity
rgba(0, 0, 0, 128) // Semi-transparent black
Constants for animatable properties:
import { PropertyKey } from '@stevysmith/rive-generator';
PropertyKey.x // X position
PropertyKey.y // Y position
PropertyKey.scaleX // X scale
PropertyKey.scaleY // Y scale
PropertyKey.rotation // Rotation (radians)
import { RiveFile, hex, PropertyKey } from '@stevysmith/rive-generator';
const riv = new RiveFile();
const artboard = riv.addArtboard({ name: 'Pulse', width: 200, height: 200 });
// Create shape
const shape = riv.addShape(artboard, { name: 'Circle', x: 100, y: 100 });
riv.addEllipse(shape, { width: 50, height: 50 });
const fill = riv.addFill(shape);
riv.addSolidColor(fill, hex('#e74c3c'));
// Create animation
const anim = riv.addLinearAnimation(artboard, {
name: 'pulse',
fps: 60,
duration: 60, // 1 second
loop: 'pingPong',
});
// Animate scale
const keyed = riv.addKeyedObject(anim, shape);
const scaleX = riv.addKeyedProperty(keyed, PropertyKey.scaleX);
riv.addKeyFrameDouble(scaleX, { frame: 0, value: 1.0, interpolation: 'cubic' });
riv.addKeyFrameDouble(scaleX, { frame: 30, value: 1.2, interpolation: 'cubic' });
riv.addKeyFrameDouble(scaleX, { frame: 60, value: 1.0, interpolation: 'cubic' });
// Same for scaleY
const scaleY = riv.addKeyedProperty(keyed, PropertyKey.scaleY);
riv.addKeyFrameDouble(scaleY, { frame: 0, value: 1.0, interpolation: 'cubic' });
riv.addKeyFrameDouble(scaleY, { frame: 30, value: 1.2, interpolation: 'cubic' });
riv.addKeyFrameDouble(scaleY, { frame: 60, value: 1.0, interpolation: 'cubic' });
writeFileSync('pulse.riv', riv.export());
MIT
FAQs
Generate .riv files programmatically with TypeScript
The npm package @stevysmith/rive-generator receives a total of 115 weekly downloads. As such, @stevysmith/rive-generator popularity was classified as not popular.
We found that @stevysmith/rive-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.