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

@types/d3-interpolate

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-interpolate

TypeScript definitions for D3JS d3-interpolate module

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-41.4%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-interpolate?

@types/d3-interpolate provides TypeScript definitions for the d3-interpolate module, which is part of the D3.js library. This module is used for interpolating between two values, which is useful for animations, transitions, and data visualizations.

What are @types/d3-interpolate's main functionalities?

Number Interpolation

This feature allows you to interpolate between two numbers. The example code demonstrates how to interpolate between 0 and 100, returning 50 when the interpolation factor is 0.5.

const d3 = require('d3-interpolate');
const interpolateNumber = d3.interpolateNumber(0, 100);
console.log(interpolateNumber(0.5)); // 50

Color Interpolation

This feature allows you to interpolate between two colors. The example code demonstrates how to interpolate between 'red' and 'blue', returning 'rgb(128, 0, 128)' when the interpolation factor is 0.5.

const d3 = require('d3-interpolate');
const interpolateColor = d3.interpolateRgb("red", "blue");
console.log(interpolateColor(0.5)); // rgb(128, 0, 128)

String Interpolation

This feature allows you to interpolate between two strings. The example code demonstrates how to interpolate between '0%' and '100%', returning '50%' when the interpolation factor is 0.5.

const d3 = require('d3-interpolate');
const interpolateString = d3.interpolateString("0%", "100%");
console.log(interpolateString(0.5)); // '50%'

Array Interpolation

This feature allows you to interpolate between two arrays. The example code demonstrates how to interpolate between [0, 1] and [10, 20], returning [5, 10.5] when the interpolation factor is 0.5.

const d3 = require('d3-interpolate');
const interpolateArray = d3.interpolateArray([0, 1], [10, 20]);
console.log(interpolateArray(0.5)); // [5, 10.5]

Object Interpolation

This feature allows you to interpolate between two objects. The example code demonstrates how to interpolate between {a: 0, b: 1} and {a: 10, b: 20}, returning {a: 5, b: 10.5} when the interpolation factor is 0.5.

const d3 = require('d3-interpolate');
const interpolateObject = d3.interpolateObject({a: 0, b: 1}, {a: 10, b: 20});
console.log(interpolateObject(0.5)); // {a: 5, b: 10.5}

Other packages similar to @types/d3-interpolate

FAQs

Package last updated on 27 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