New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

offcircle

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

offcircle

Recreation of Matplotlib ellipse demo

latest
Source
npmnpm
Version
3.0.2
Version published
Maintainers
1
Created
Source

offcircle

Logo
JavaScript Generative Art
A recreation of the Matplotlib Ellipse Demo in JavaScript

NPM Version

Installation

npm install offcircle

API

The offCircle function operates on the Canvas API (node & browser).

  • ctx = 2D canvas context to render on
  • ellipseCount = Number of ellipses to render on the canvas (defaults to 120)

returns Void

offCircle(ctx,ellipseCount)

Usage

Node

import fs from 'fs'
import path from 'path'
import Canvas from 'canvas'
import offCircle from 'offcircle'

// or common js

var fs = require('fs')
var path = require('path')
var Canvas = require('canvas')
var offCircle = require('offcircle')

var canvas = Canvas.createCanvas(500, 500)
var ctx = canvas.getContext('2d')
offCircle(ctx, 120)

var out = fs.createWriteStream(path.join(__dirname, '/example.png'))
var stream = canvas.createPNGStream()
stream.on('data', function (chunk) {
  out.write(chunk)
})

Web (React)

import React, { useEffect } from 'react';
import './App.css';
import offCircle from "offcircle";

function App() {
  const canvasRef = React.useRef(null);
  useEffect(()=> {
    const canvas = canvasRef.current
    const ctx = canvas.getContext('2d')
    offCircle(ctx,1000)
  })
  return (
    <div className="App">
    <canvas
      ref={canvasRef}
      width={window.innerWidth}
      height={window.innerHeight}
    />
    </div>
  );
}

export default App;

License

MIT

Original Matplotlib Python Demo

Ellipse Demo

Keywords

ellipse

FAQs

Package last updated on 19 Apr 2020

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