npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@romellogoodman/flow-field

v0.0.4

Published

A library for generating flow fields.

Downloads

6

Readme

flow-field

npm version

A library for generating flow fields.

Demo: Codesandbox Demo

Resources for learning more about flow fields and noise:

Table of contents

Usage

Install

npm

npm i @romellogoodman/flow-field

unpkg

<script src="https://unpkg.com/@romellogoodman/flow-field"></script>

Use

import {generateField} from '@romellogoodman/flow-field';

const field = generateField({count: 100, height: 1000, width: 1000});

API

generateParticles

Creates the particles for a flow field.

  • @param {Number} count Number of particles in the field.
  • @param {Number} height Height of space.
  • @param {Number} margin Percent of height/width to create a padding.
  • @param {String} seed Random (random-js) seed.
  • @param {Number} width Width of space.
  • @return {Array} List of particle objects containing the starting x and y coordinates.

moveParticle

Computes the new position for a particle and adds it to the particle.line array.

  • @param {Number} amplitude Controls the range of values we get from the noise function.
  • @param {Number} damping Slows down the particle (think friction).
  • @param {Number} frequency Controls how quickly/slowly the noise function is "evolving over time".
  • @param {Number} lengthOfStep Amount to move the coordinate.
  • @param {Object} particle Particle object containing the.
  • @return {Void} Operates on the particle and returns nothing.

generateField

Creates a flow field with particles and lines.

  • @param {Number} amplitude Controls the range of values we get from the noise function. Default to 5.
  • @param {Number} count Number of particles in the field. Default to 1000.
  • @param {Number} damping Percentage that slows down the particle (think friction). Default to 0.1.
  • @param {Number} height Height of space.
  • @param {Number} margin Percent of height/width to create a padding. Default to 0.1.
  • @param {Object} particles List of particles to use instead of generating them.
  • @param {String} scale Used to compute frequency, number of steps and step length. Default to 1.
  • @param {String} seed Random (random-js) seed.
  • @param {Number} width Width of space.
  • @return {Array} List of particle objects containing the line coordinates.

Contributing

All contributors and all contributions both big and small are welcome in this project.