Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/utkarshdubey/react-spline

A wrapper to painlessly integrate Spline projects into your React code-space. ☀
https://github.com/utkarshdubey/react-spline

animation react react-spline spline threejs

Last synced: 1 day ago
JSON representation

A wrapper to painlessly integrate Spline projects into your React code-space. ☀

Awesome Lists containing this project

README

        

# React Spline

[![NPM](https://img.shields.io/npm/v/react-spline.svg)](https://www.npmjs.com/package/react-spline) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Archive Notice
The repository has been archived now since Spline has released their official library [@splinetool/react-spline](https://www.npmjs.com/package/@splinetool/react-spline) for importing models. I had fun maintaining this project, if your existing workspace is using `react-spline`, the transitioning won't be hard since most of the generics are similar. Thanks for stopping by.

A painless, configurable, [spline](https://spline.design) wrapper for React to add sweet animations easily into your projects.

![Demo Gif](./demo.gif)

## Install

```bash
npm install --save react-spline
```

or

```bash
yarn add react-spline
```

## Usage

Import the `Spline` component from `react-spline` and you're set.

```tsx
import React, { Component } from 'react'

import { Spline } from 'react-spline'
import SCENE_OBJECT from './scene.json'

class Example extends Component {
render() {
return
}
}
```

## Props

| Property | Description |
| --------------------- | ------------------------------------------------------------------------ |
| scene `object` | Required. The scene object exported from Spline. |
| id `string` | Default empty. Assignable HTMLAttribute `id` for the `` element. |
| className `string` | Default empty. Assignable HTMLAttribute `class` for the `

` wrapper. |
| style `JSX CSS` | Default empty. Custom styling for the `
` wrapper. |
| canvasStyle `JSX CSS` | Default empty. Custom styling for the `` element. |

## Loading the Spline model
To download Spline models from the link that gets generated in Spline, it's accessible at ``https://my.spline.design/example-8b43571.../scene.json`` (**Note**: Here *example-8b43571* in the link is a placeholder for a Spline generated link). You can then import the object and use it like shown above.

## Multiple THREE.js Warning Issue
The older versions of this library experience a ~~bug~~ problem, where outdated usage of functions in the Spline runtime cause multiple duplicate warnings to clutter the console. For now, it has been disabled by a workaround script that removes duplicate warnings from the console until we have a proper solution.

## License

MIT © [utkarshdubey](https://github.com/utkarshdubey)