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

phases

v1.0.7

Published

A wide range of mathematical functions for shape representation and curve generation

Downloads

7

Readme

Phases

Phases is a powerful NPM package designed to empower developers with the ability to create captivating visual effects and dynamic transformations using trigonometric functions. With phases, you can easily incorporate sine, cosine, tangent, and other mathematical formulas associated with structures and shapes into your HTML elements, providing a unique and visually appealing user experience.

Features

  • Simplified API: phases offers a simple and intuitive API, making it effortless to integrate trigonometry-based transformations into your projects.
  • Div Wave Effects: Transform your divs into mesmerizing wave patterns by applying the sine function. Adjust the wave amplitude using customizable parameters to achieve the desired visual effect.
  • Mathematical Formulas: Access a wide range of mathematical formulas associated with structure and shape manipulation, enabling you to create complex animations and designs with ease.
  • Cross-browser Compatibility: phases ensures seamless compatibility across major web browsers, allowing your creations to be enjoyed by users on different platforms.

Installation

To install phases, simply run the following command:

npm install phases

Usage

To use phases, first import the module:

const Phases = require('phases');

Then, you can apply the sine, cosine, or tangent wave effect to a div by calling the corresponding function:

// Apply sine wave effect to a div
Phases.sineWave(div, amplitude, frequency, phaseShift);

// Apply cosine wave effect to a div
Phases.cosineWave(div, amplitude, frequency, phaseShift);

// Apply tangent wave effect to a div
Phases.tangentWave(div, amplitude, frequency, phaseShift);

// Apply linear function to a div
Phases.linearFunction(div, m, b);

// Apply quadratic function to a div
Phases.quadraticFunction(div, a, b, c);

// Apply cubic function to a div
Phases.cubicFunction(div, a, b, c, d);

// Apply quadratic bezier curve to a div
Phases.quadraticBezierCurve(div, p0, p1, p2);

// Apply cubic bezier curve to a div
Phases.cubicBezierCurve(div, p0, p1, p2, p3);

// Apply circle function to a div
Phases.circleFunction(div, h, k, r);

// Apply gaussian function to a div
Phases.gaussianFunction(div, amplitude, mean, standardDeviation);

// Apply piecewise functions to a div
Phases.piecewiseFunctions(div, conditions);

// Apply parametric equations to a div
Phases.parametricEquations(div, equations);

// Apply ellipse function to a div
Phases.ellipseFunction(div, h, k, a, b);

// Apply hyperbola function to a div
Phases.hyperbolaFunction(div, h, k, a, b);

// Apply exponential function to a div
Phases.exponentialFunction(div, a, b);

API

sineWave(div, amplitude, frequency, phaseShift)

Applies the sine wave effect to a div.

  • div - The div element to apply the effect to.
  • amplitude - The amplitude of the wave.
  • frequency - The frequency of the wave.
  • phaseShift - The phase shift of the wave.

cosineWave(div, amplitude, frequency, phaseShift)

Applies the cosine wave effect to a div.

  • div - The div element to apply the effect to.
  • amplitude - The amplitude of the wave.
  • frequency - The frequency of the wave.
  • phaseShift - The phase shift of the wave.

tangentWave(div, amplitude, frequency, phaseShift)

Applies the tangent wave effect to a div.

  • div - The div element to apply the effect to.
  • amplitude - The amplitude of the wave.
  • frequency - The frequency of the wave.
  • phaseShift - The phase shift of the wave.

linearFunction(div, m, b)

Applies the linear function to a div.

  • div - The div element to apply the effect to.
  • m - The slope of the line.
  • b - The y-intercept of the line.

quadraticFunction(div, a, b, c)

Applies the quadratic function to a div.

  • div - The div element to apply the effect to.
  • a - The coefficient of the quadratic term.
  • b - The coefficient of the linear term.
  • c - The constant term.

cubicFunction(div, a, b, c, d)

Applies the cubic function to a div.

  • div - The div element to apply the effect to.
  • a - The coefficient of the cubic term.
  • b - The coefficient of the quadratic term.
  • c - The coefficient of the linear term.
  • d - The constant term.

quadraticBezierCurve(div, p0, p1, p2)

Applies the quadratic bezier curve to a div.

  • div - The div element to apply the effect to.
  • p0 - The starting point of the curve.
  • p1 - The control point of the curve.
  • p2 - The ending point of the curve.

cubicBezierCurve(div, p0, p1, p2, p3)

Applies the cubic bezier curve to a div.

  • div - The div element to apply the effect to.
  • p0 - The starting point of the curve.
  • p1 - The first control point of the curve.
  • p2 - The second control point of the curve.
  • p3 - The ending point of the curve.

circleFunction(div, h, k, r)

Applies the circle function to a div.

  • div - The div element to apply the effect to.
  • h - The x-coordinate of the center of the circle.
  • k - The y-coordinate of the center of the circle.
  • r - The radius of the circle.

gaussianFunction(div, amplitude, mean, standardDeviation)

Applies the gaussian function to a div.

  • div - The div element to apply the effect to.
  • amplitude - The amplitude of the curve.
  • mean - The mean of the curve.
  • standardDeviation - The standard deviation of the curve.

piecewiseFunctions(div, conditions)

Applies the piecewise functions to a div.

  • div - The div element to apply the effect to.
  • `

License

Phases is licensed under the MIT License.