Giter Club home page Giter Club logo

react-native-blobular's Introduction

react-native-blobular

The Man in Blue's awesome Blobular, ported to React Native. Find the original experiment here!

๐Ÿš€ Getting Started

Using npm:

npm install --save react-native-blobular

Using yarn:

yarn add react-native-blobular

This project depends on react-native-svg, so be sure that the library has been linked if you're running anything less than [email protected].

โœ๏ธ Example

It's pretty simple, just embed a <Blobular /> inside your render method, then listen for the onBlobular callback, where you can allocate a number of Blobs for your user to play around with.

import React from 'react';
import { Dimensions } from 'react-native';
import uuidv4 from 'uuid/v4';

import Blobular, { Blob } from 'react-native-blobular';

const { width, height } = Dimensions
  .get('window');

export default () => (
  <Blobular
    onBlobular={({ putBlob }) => putBlob(
      new Blob(
        uuidv4(), // unique id
        100, // radius
        75, // viscosity
        50, // min radius
      ),
      width * 0.5,
      height * 0.5,
    )}
  />
);

You can also suppress user interaction by supplying pointerEvents="none" to your <Blobular /> component, and instead use the blobular instance returned in the callback to programmatically manipulate what's on screen.

๐Ÿ“Œ Props

Property Type Required Description
width number no Width of the view.
height number no Height of the view.
renderBlob func no A function you can pass to define the SVG path.
pointerEvents string no Allow the user to interact, or manipulate programmatically.
onBlobular func no A callback returning you with a blobular instance.
onBlobCreated func no A callback for when a new blob has been generated.
onBlobDeleted func no A callback for when an existing blob has been removed.

โœŒ๏ธ License

MIT

react-native-blobular's People

Contributors

cawfree avatar

Watchers

 avatar

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.