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 🙏

© 2026 – Pkg Stats / Ryan Hefner

d3-fisheye

v2.1.2

Published

An implementation of the fisheye effect with a smooth transition at the edge.

Downloads

148

Readme

d3-fisheye

A fisheye module that includes the option to smoothly transition out of the fisheye effect rather than the abrupt discontinuity at the edge of Sarkar-Brown-based implementations. See https://observablehq.com/@duaneatat/smoothed-fisheye for details.

Installing

npm install d3-fisheye or yarn add d3-fisheye

API Reference

See https://bl.ocks.org/duaneatat/315b00c4747e747054ba0287035794d6 for an example comparing fisheye with and without smoothing enabled.

Example:

const fisheye = d3Fisheye.radial()
  .radius(250)
  .distortion(4)
  .smoothing(0.5);

fisheye.focus([10, 50]);
console.log(fisheye([10, 100])); // [ 10, 168.48674177847914, 2.369734835569583 ]

The values returned correspond to the x, y, and z coordinates of the transformed input point. The z value can be used to scale elements inside the fisheye effect. The z value is maximum at the center of the fisheye effect, where it will equal the distortion. 1 is the z value for un-transformed points.

The smoothing option is the fraction of the radius that is used to smoothly transition back out of the fisheye effect. A value of 0 would result in the usual Sarkar-Brown fisheye effect, e.g. here and here. A value of 1 would result in no fisheye effect at all. Default is 0.2.

Inverse

The original point can be recovered by passing true as the second parameter to the fisheye function.

Example:

const fisheye = d3Fisheye.radial()
  .radius(250)
  .distortion(4)
  .smoothing(0.5);

fisheye.focus([10, 50]);
console.log(fisheye(fisheye([10, 100]), true)); // ~[ 10, 100 ]