Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sinusoidal-decimal

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinusoidal-decimal

Input a number and a range (min-max), get the number's position along the range eased by a sine curve

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sinusoidal-decimal

This is a lightweight way to apply a sine curve to numbers in a numeric range.

It is similar to easing, but intended for cases where you have a numeric start point, end point, and position(s) relative to these points.

const sinusoidal = require('sinusoidal-decimal')

// Usage: sinusoidal(value, min, max, returnDecimal)

sinusoidal(0, 10, 50) // 10
sinusoidal(10, 10, 50) // 10
sinusoidal(20, 10, 50) // 15.8578...
sinusoidal(30, 10, 50) // 30
sinusoidal(40, 10, 50) // 44.1421...
sinusoidal(50, 10, 50) // 50
sinusoidal(60, 10, 50) // 50

// If returnDecimal flag is true, returns decimal position on sine curve

sinusoidal(0, 10, 50, true) // 0
sinusoidal(10, 10, 50, true) // 0
sinusoidal(20, 10, 50, true) // 0.1464...
sinusoidal(30, 10, 50, true) // 0.5
sinusoidal(40, 10, 50, true) // 0.8535...
sinusoidal(50, 10, 50, true) // 1
sinusoidal(60, 10, 50, true) // 1

License

MIT

Keywords

FAQs

Package last updated on 25 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc