Giter VIP home page Giter VIP logo

react-spline's Introduction

React Spline

NPM JavaScript Style Guide

Archive Notice

The repository has been archived now since Spline has released their official library @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 wrapper for React to add sweet animations easily into your projects.

Demo Gif

Install

npm install --save react-spline

or

yarn add react-spline

Usage

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

import React, { Component } from 'react'

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

class Example extends Component {
  render() {
    return <Spline scene={SCENE_OBJECT} />
  }
}

Props

Property Description
scene object Required. The scene object exported from Spline.
id string Default empty. Assignable HTMLAttribute id for the <canvas> element.
className string Default empty. Assignable HTMLAttribute class for the <div> wrapper.
style JSX CSS Default empty. Custom styling for the <div> wrapper.
canvasStyle JSX CSS Default empty. Custom styling for the <canvas> 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.