Skip to content

A lightweight and high performance JavaScript library for creating physical particles

Notifications You must be signed in to change notification settings

LongYue9608/Qarticles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qarticles

A lightweight and high performance JavaScript library for creating particles

preview.gif

Live Demos

click here.

Install

  • base

your html

<script src="src_to_qarticles.js"></script>
  • npm
npm i Qarticles --save

your app.js

import Qarticles from 'Qarticles'

Usage

var canvas = document.getElementById('cov')
var qarticles = new Qarticles(canvas)

Options

var canvas = document.getElementById('cov')

var covColorFuc = function (dot, w, h) {
    return `rgba(${Math.floor(255 * (1 - dot.x / w))}, ${Math.floor(255 * (1 - dot.y / h))},${Math.floor(255 * (dot.speedArr[0]/ 100))}, 0.4)`
}

var lineColorFuc = function (dot, w, h) {
    return `rgba(${Math.floor(255 * (1 - dot.x / w))}, ${Math.floor(255 * (1 - dot.y / h))},${Math.floor(255 * (dot.speedArr[0]/ 100))}, 0.1)`
}

var covSpeedFuc = function (speed) {
    return  Math.random() * speed * (Math.random() * 10 > 5 ? -1 : 1)
}

var options = {
    lineLink: {
        count: 2,
        show: true
    },
    color: {
        dotColorFuc: covColorFuc,
        lineColorFuc: lineColorFuc,
    },
    dot: {
        physical: true,
        speed: speed,
        vxFuc: covSpeedFuc,
        vyFuc: covSpeedFuc,
        count: 80,
        size: {
            random: true,
            max: 20,
            min: 0
        }
    }
    
}

var qarticles = new Qarticles(canvas, options)

License

This project is licensed under the terms of the MIT license.

About

A lightweight and high performance JavaScript library for creating physical particles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%