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

circles

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circles

Circle user interface library targeted for artificial life simulations.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

circles.jsv0.2.0

Circle user interface library targeted for artificial life simulations.

Install

Installation

Browsers

<script src="scripts/circles.js"></script>

CommonJS & Node.js

$ npm install circles
---
> var circles = require('circles');

API

circles.createWorld()

Creates canvas element and required styles. The element resizes automatically on window resize.

var world = circles.createWorld()

world.createCircle(x, y, r, color)

Position and radius in pixels. Color can be any canvas fill style, e.g. '#ff0000' or 'red'

var circle = world.createCircle(100, 200, 20, 'red')

world.searchInside(x, y, r)

Return array of circles inside the specified circle area. Use this for collision detection.

world.on(event, handler)

Possible events: 'tap'

world.off(event)

Remove event handler.

circle.moveTo(x, y)

circle.moveBy(dx, dy)

circle.movePolar(distance, angle)

Move circle to the specified direction. Angle in radians.

circle.moveToward(x, y, distance)

Move circle toward the specified point.

circle.on(event, handler)

Possible events: 'tap'

circle.off(event)

Remove event handler.

Notes for developers

Run tests with $ npm test.

Build with $ npm run build.

Serve with $ npm start. Then see localhost:8000.

Todo

  • tests

Versioning

Semantic Versioning 2.0.0

License

MIT License

Keywords

FAQs

Package last updated on 08 Feb 2015

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