0.0.1 • Published 2 years ago

react-interactive-blob v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-Interactive Blob

React Interactive Blob is an interactive and customizable blob component for react applications. It is built in TypeScript. It can be used just like any other React JSX Component.

  • ✅ Dependency-Free
  • ✅ TypeScript Supported
  • ✅ Simple API
  • ✅ No Physics knowledge required

Getting Started

Install react-interactive-blob

npm install react-interactive-blob
yarn add react-interactive-blob

Add to your project

import { Blob } from 'react-interactive-blob'

function MyComponent() {
  return <Blob height={500} radius={150} />
}

API

NameDescriptionTypeDefault Value
colorColor of the blob component. Right now only solid colors are supportedstring"#2f4acf"
radiusThe outer canvas pixel radius of the blob at still positionnumber128
sensitivitySensitivity of the blob component to mouse jitternumber0.5
frictionThe coefficient of friction for blob movement.number0.0095
elasticityElasticity coefficient of the blob point connectionsnumber0.001
accelerationThe acceleration of each point making up the blobnumber- 1 + Math . random () * 0.1
radialThe radial effect of each point making up the blobnumber0.1
pointsThe number of points used to construct the shape. Note that there must be at least three pointsnumber32
speedThe speed of continuous point motionnumber0.5
heightThe height of the container canvas elementnumberwindow.innerHeight
smoothingWhether a quadratic curve should be constructed between pointsbooleantrue
markersWhether to show square markers at each point vertexbooleanfalse
showMousePositionWhether to show the position of the mouse relative to the blobbooleanfalse

Interactive Example

View Interactive Example