2.0.2 • Published 2 years ago

thpace v2.0.2

Weekly downloads
96
License
ISC
Repository
github
Last release
2 years ago

Thpace

Thpace is a pretty canvas creation of mine. It makes a space animation out of triangles.

Example

Usage

You can install Thpace through NPM as a module, or through a CDN

NPM

yarn add thpace - or - npm install thpace

CDN

https://unpkg.com/thpace Will get you the minified build

Then, you can import:

<script src="https://unpkg.com/thpace"></script>

Ok but like what code do I write to use it?

import { ThpaceGL } from 'thpace';
// or
const { ThpaceGL } = require('thpace');
// or, if you used the CDN, skip those

const canvas = document.querySelector('#make-me-cool');

const settings = {
	colors: ['#4CB1EF', '#424959', '#FF4B44'],
	triangleSize: 100,
};

ThpaceGL.create(canvas, settings);

Some Info

Settings

SettingAcceptsDefaultDescription
triangleSizenumber130Triangle size (px)
bleednumber120Bleed amount over canvas edges (px)
noisenumber60Noise used when calculating points (px)
colorsArray\['rgba(11,135,147,1)', 'rgba(54,0,51,1)']Array of colors to use for the gradient
pointVariationXnumber20How much the points should shift on the x-axis (px)
pointVariationYnumber35How much the points should shift on the y-axis (px)
pointAnimationSpeednumber7500How fast the points should complete a loop (ms)
animationOffsetnumber250Interval on the x-axis for the animation offset (px)
maxFpsnumber144Limit how many frames are drawn per second
automaticResizebooleantrueSet to false to prevent Thpace from reacting to resize events
particleSettingsParticleSettings{}Settings for the particles

Particle Settings

SettingAcceptsDefaultDescription
countnumber || [min, max][2, 5]How many particles should be generated per 100 pixels
intervalnumber || [min, max][5000, 10000]Interval for a particle to complete it's animation (ms)
radiusnumber || [min, max][1, 2]Particle radius (px)
opacitynumber || [min, max][.1, .7]Particle opacity
variationXnumber || [min, max][5, 15]Variation in the particle animation on the x-axis (px)
variationYnumber || [min, max][2.5, 7.5]Variation in the particle animation on the y-axis (px)
colorstring#ffffffColor of the particles
2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.0

3 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago