New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

circle-split

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circle-split

Inspired by a d3.js project [ImageMap](http://bl.ocks.org/nswamy14/df13d67b6efeb19eb640), I created a canvas version of it, which supports PC and mobile devices.

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

description

Inspired by a d3.js project ImageMap, I created a canvas version of it, which supports PC and mobile devices.

screenshot

demo

Here is the online demo, select an image and move or touch screen

install

npm i circle-split

or include the source JS file directly

<script src="circle-split.min.js"></script>

usage

initiate

var cs = new CircleSplit('#mountNode', {
  size: 300,
  minDiameter: 4,
  imageCenterType: 'cover',
  eventEnabled: true
});

default options

var defaultOptions = {
  size: 'auto',     // will set mininum value of mountNode's width and height
  minDiameter: 2,   // the circle can split until the diameter reaches to 2 px
  imageCenterType: 'contain',  // designate the center type when put the image of the square box
  eventEnabled: true // enable touchmove and mouseove event
};

public methods

// you can set image by path or an already loaded image element
cs.setImage('path/to/your/image.jpg')
cs.setImage(document.getElementById('targetImageElement'))

// set pure color
cs.setColor('rgba(255,0,0)');

// split
cs.split() // split all circles into next level
cs.split(level) // split all circles into target level
cs.split(x, y) // split hit circle into next level
cs.split(x, y, level) // split hit circle into target level, target level should be higher than circle's current level

// you can bind and unbind event any time
cs.bindEvent()
cs.unbindEvent()

// if you don't need this, please call destroy method
cs.destroy()

FAQs

Package last updated on 07 Jan 2017

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