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

@ngx-p5/core

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngx-p5/core

This package provides an easy way to use p5 instance mode, working with classes and CSS selector to attach your sketch. Demo [here!](https://codepen.io/redfox-mx/pen/VwWaVgP)

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

@ngx-p5/core

This package provides an easy way to use p5 instance mode, working with classes and CSS selector to attach your sketch. Demo here!

Installation

npm install @ngx-p5/core p5
# or
yarn add @ngx-p5/core p5

Optional, you can install @types/p5

How to use

const sketch = function (p: p5) {  // if you install @types/p5
  /* your awsome sketch */
  p.setup = function() {
    p.createCanvas(200, 400)
    /*  code */
  }

  p.draw = function() {
    p.line(p.width / 2, 0, p.width / 2, 0);
    /* motion and magic here */
  }
}

createCanvas(sketch, '#awsome-sketch');

Optionally you can create a class to manage complexity or integrate with another class base library.

class AwsomeSketch {
    setup(p: any ) { // with typescript 
      /* your setup */
    }
    draw(p) { // with javascript
      /* magic here! */
      p.background(0) // black magic color
    }
}

const sketch = toSketch(new AwsomeSketch());
createCanvas(sketch, '#awsome-sketch');

Example: you can see in action in codepen

Fractals

You can use defaul functionality and ommit second param to attach sketch to body createCanvas(sketch).

Keywords

angular

FAQs

Package last updated on 02 Sep 2021

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