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

particle-ins

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

particle-ins

Optimized particle system written in Typescript using WebGL

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

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

Particle-ins

Description

Particle-ins is a library to quickly and efficiently create particle effects.

Written in Typescript, uses WebGL for rendering.

Installation

$> npm install particle-ins

Usage

Import the library.

import * as particle-ins from "particle-ins";

Or if you prefer

import { ParticleSystem, ...etc } from "particle-ins";

Demo

Live demo! http://emilsunesson.com/docs/particle-ins

Api

IpsOptions

color: Color in hex

alpha: Alpha 0-1

textures: Custom textures

startOnEntry: Start particle system when canvas enters viewport stops when not in viewport. Default true

To start particle system when startOnEntry is False.

particleSystem.onLoad.subscribe(it => {
    particleSystem.start();
});
Example
let customTexture: ImageItem = {
    image: "../assets/images/snowflake.png",
    key: "snow"
};

let options = new IpsOptions();
options.textures = [snowTexture];
options.color = "cccccc"
    
new ParticleSystem(options, canvas, 1000, 600);

IpsEmitterOptions

startPosition: Min/max position of x and y

velocity: Min/max velocity of x and y

particlesSec: Number of particles emitted per second

lifeTime: lifetime of particles in milliseconds

size: Min/max size

growth: Growth plus value grows minus value shrinks

color: Color in hex

alpha: Alpha 0-1

renderMode: Static or dynamic rendering if static generate particles once otherwise generate continuously

blendmodeSource: Webgl blendmode source

blendmodeTarget: Webgl blendmode target

positionType: Pixel or relative position type

textureKey: Custom texture key

Example
let emitterOptions = new IpsEmitterOptions(
    new IpsCoordinates(-1, 1, 1, 1),
    new IpsCoordinates(-0.5, 0.5, -0.8, -0.8),
    1000,
    2500
);

emitterOptions.size = { min: 3, max: 8 }
emitterOptions.textureKey = "snow";
emitterOptions.positionType = IpsPositiontype.Relative;

particleSystem.addEmitter(emitterOptions);

Keywords

FAQs

Package last updated on 01 May 2019

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