@tsparticles/effect-shadow 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/176.min.js +2 -0
- package/176.min.js.LICENSE.txt +1 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/browser/ShadowDrawer.js +32 -0
- package/browser/index.js +7 -0
- package/browser/package.json +1 -0
- package/cjs/ShadowDrawer.js +32 -0
- package/cjs/index.js +7 -0
- package/cjs/package.json +1 -0
- package/dist_browser_ShadowDrawer_js.js +30 -0
- package/esm/ShadowDrawer.js +32 -0
- package/esm/index.js +7 -0
- package/esm/package.json +1 -0
- package/package.json +109 -0
- package/report.html +40 -0
- package/tsparticles.effect.shadow.js +317 -0
- package/tsparticles.effect.shadow.min.js +2 -0
- package/tsparticles.effect.shadow.min.js.LICENSE.txt +1 -0
- package/types/ShadowDrawer.d.ts +14 -0
- package/types/index.d.ts +2 -0
- package/umd/ShadowDrawer.js +46 -0
- package/umd/index.js +54 -0
package/176.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 176.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_effect_shadow=this.webpackChunk_tsparticles_effect_shadow||[]).push([[176],{176(o,s,e){e.d(s,{ShadowDrawer:()=>t});var a=e(303);class t{constructor(o){this._engine=o}drawBefore(o){const{particle:s,context:e}=o,{container:t}=s,r=s,d=r.shadowEnabled,h=r.shadowColor,w=r.shadowOffset;d&&h&&(e.shadowBlur=r.shadowBlur??0,e.shadowColor=(0,a.getStyleFromRgb)(h,t.hdr),e.shadowOffsetX=w?.x??0,e.shadowOffsetY=w?.y??0)}particleInit(o,s){const e=s.effectData;if(!e?.enable)return s.shadowBlur=void 0,s.shadowColor=void 0,s.shadowOffset=void 0,void(s.shadowEnabled=!1);const t=a.OptionsColor.create(new a.OptionsColor,e.color);s.shadowColor=(0,a.rangeColorToRgb)(this._engine,t),s.shadowBlur=e.blur,s.shadowOffset=e.offset,s.shadowEnabled=!0}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Shadow Shape v4.0.0-alpha.0 by Matteo Bruni */
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Matteo Bruni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[](https://particles.js.org)
|
|
2
|
+
|
|
3
|
+
# tsParticles Shadow Effect
|
|
4
|
+
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/@tsparticles/effect-shadow)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/effect-shadow)
|
|
7
|
+
[](https://www.npmjs.com/package/@tsparticles/effect-shadow) [](https://github.com/sponsors/matteobruni)
|
|
8
|
+
|
|
9
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) additional shadow effect.
|
|
10
|
+
|
|
11
|
+
## How to use it
|
|
12
|
+
|
|
13
|
+
### CDN / Vanilla JS / jQuery
|
|
14
|
+
|
|
15
|
+
The CDN/Vanilla version JS has one required file in vanilla configuration:
|
|
16
|
+
|
|
17
|
+
Including the `tsparticles.effect.shadow.min.js` file will export the function to load the effect:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
loadShadowEffect
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Usage
|
|
24
|
+
|
|
25
|
+
Once the scripts are loaded you can set up `tsParticles` and the effect like this:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
(async () => {
|
|
29
|
+
await loadShadowEffect(tsParticles);
|
|
30
|
+
|
|
31
|
+
await tsParticles.load({
|
|
32
|
+
id: "tsparticles",
|
|
33
|
+
options: {
|
|
34
|
+
/* options */
|
|
35
|
+
/* here you can use particles.effect.type: "shadow" */
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
})();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### ESM / CommonJS
|
|
42
|
+
|
|
43
|
+
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
$ npm install @tsparticles/effect-shadow
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
or
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
$ yarn add @tsparticles/effect-shadow
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then you need to import it in the app, like this:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const { tsParticles } = require("@tsparticles/engine");
|
|
59
|
+
const { loadShadowEffect } = require("@tsparticles/effect-shadow");
|
|
60
|
+
|
|
61
|
+
(async () => {
|
|
62
|
+
await loadShadowEffect(tsParticles);
|
|
63
|
+
})();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
or
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { tsParticles } from "@tsparticles/engine";
|
|
70
|
+
import { loadShadowEffect } from "@tsparticles/effect-shadow";
|
|
71
|
+
|
|
72
|
+
(async () => {
|
|
73
|
+
await loadShadowEffect(tsParticles);
|
|
74
|
+
})();
|
|
75
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OptionsColor, getStyleFromRgb, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
+
const defaultShadowBlur = 0, defaultShadowOffsetValue = 0;
|
|
3
|
+
export class ShadowDrawer {
|
|
4
|
+
constructor(engine) {
|
|
5
|
+
this._engine = engine;
|
|
6
|
+
}
|
|
7
|
+
drawBefore(data) {
|
|
8
|
+
const { particle, context } = data, { container } = particle, shadowParticle = particle, shadowEnabled = shadowParticle.shadowEnabled, shadowColor = shadowParticle.shadowColor, shadowOffset = shadowParticle.shadowOffset;
|
|
9
|
+
if (!shadowEnabled || !shadowColor) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
context.shadowBlur = shadowParticle.shadowBlur ?? defaultShadowBlur;
|
|
13
|
+
context.shadowColor = getStyleFromRgb(shadowColor, container.hdr);
|
|
14
|
+
context.shadowOffsetX = shadowOffset?.x ?? defaultShadowOffsetValue;
|
|
15
|
+
context.shadowOffsetY = shadowOffset?.y ?? defaultShadowOffsetValue;
|
|
16
|
+
}
|
|
17
|
+
particleInit(_container, particle) {
|
|
18
|
+
const effectData = particle.effectData;
|
|
19
|
+
if (!effectData?.enable) {
|
|
20
|
+
particle.shadowBlur = undefined;
|
|
21
|
+
particle.shadowColor = undefined;
|
|
22
|
+
particle.shadowOffset = undefined;
|
|
23
|
+
particle.shadowEnabled = false;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const shadowColor = OptionsColor.create(new OptionsColor(), effectData.color);
|
|
27
|
+
particle.shadowColor = rangeColorToRgb(this._engine, shadowColor);
|
|
28
|
+
particle.shadowBlur = effectData.blur;
|
|
29
|
+
particle.shadowOffset = effectData.offset;
|
|
30
|
+
particle.shadowEnabled = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/browser/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OptionsColor, getStyleFromRgb, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
+
const defaultShadowBlur = 0, defaultShadowOffsetValue = 0;
|
|
3
|
+
export class ShadowDrawer {
|
|
4
|
+
constructor(engine) {
|
|
5
|
+
this._engine = engine;
|
|
6
|
+
}
|
|
7
|
+
drawBefore(data) {
|
|
8
|
+
const { particle, context } = data, { container } = particle, shadowParticle = particle, shadowEnabled = shadowParticle.shadowEnabled, shadowColor = shadowParticle.shadowColor, shadowOffset = shadowParticle.shadowOffset;
|
|
9
|
+
if (!shadowEnabled || !shadowColor) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
context.shadowBlur = shadowParticle.shadowBlur ?? defaultShadowBlur;
|
|
13
|
+
context.shadowColor = getStyleFromRgb(shadowColor, container.hdr);
|
|
14
|
+
context.shadowOffsetX = shadowOffset?.x ?? defaultShadowOffsetValue;
|
|
15
|
+
context.shadowOffsetY = shadowOffset?.y ?? defaultShadowOffsetValue;
|
|
16
|
+
}
|
|
17
|
+
particleInit(_container, particle) {
|
|
18
|
+
const effectData = particle.effectData;
|
|
19
|
+
if (!effectData?.enable) {
|
|
20
|
+
particle.shadowBlur = undefined;
|
|
21
|
+
particle.shadowColor = undefined;
|
|
22
|
+
particle.shadowOffset = undefined;
|
|
23
|
+
particle.shadowEnabled = false;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const shadowColor = OptionsColor.create(new OptionsColor(), effectData.color);
|
|
27
|
+
particle.shadowColor = rangeColorToRgb(this._engine, shadowColor);
|
|
28
|
+
particle.shadowBlur = effectData.blur;
|
|
29
|
+
particle.shadowOffset = effectData.offset;
|
|
30
|
+
particle.shadowEnabled = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/cjs/index.js
ADDED
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
/*
|
|
11
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
+
* This devtool is neither made for production nor for readable output files.
|
|
13
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
+
* or disable the default devtool with "devtool: false".
|
|
16
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
+
*/
|
|
18
|
+
(this["webpackChunk_tsparticles_effect_shadow"] = this["webpackChunk_tsparticles_effect_shadow"] || []).push([["dist_browser_ShadowDrawer_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/ShadowDrawer.js"
|
|
21
|
+
/*!**************************************!*\
|
|
22
|
+
!*** ./dist/browser/ShadowDrawer.js ***!
|
|
23
|
+
\**************************************/
|
|
24
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ShadowDrawer: () => (/* binding */ ShadowDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultShadowBlur = 0,\n defaultShadowOffsetValue = 0;\nclass ShadowDrawer {\n constructor(engine) {\n this._engine = engine;\n }\n drawBefore(data) {\n const {\n particle,\n context\n } = data,\n {\n container\n } = particle,\n shadowParticle = particle,\n shadowEnabled = shadowParticle.shadowEnabled,\n shadowColor = shadowParticle.shadowColor,\n shadowOffset = shadowParticle.shadowOffset;\n if (!shadowEnabled || !shadowColor) {\n return;\n }\n context.shadowBlur = shadowParticle.shadowBlur ?? defaultShadowBlur;\n context.shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(shadowColor, container.hdr);\n context.shadowOffsetX = shadowOffset?.x ?? defaultShadowOffsetValue;\n context.shadowOffsetY = shadowOffset?.y ?? defaultShadowOffsetValue;\n }\n particleInit(_container, particle) {\n const effectData = particle.effectData;\n if (!effectData?.enable) {\n particle.shadowBlur = undefined;\n particle.shadowColor = undefined;\n particle.shadowOffset = undefined;\n particle.shadowEnabled = false;\n return;\n }\n const shadowColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor(), effectData.color);\n particle.shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToRgb)(this._engine, shadowColor);\n particle.shadowBlur = effectData.blur;\n particle.shadowOffset = effectData.offset;\n particle.shadowEnabled = true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/effect-shadow/./dist/browser/ShadowDrawer.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ }
|
|
29
|
+
|
|
30
|
+
}]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OptionsColor, getStyleFromRgb, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
+
const defaultShadowBlur = 0, defaultShadowOffsetValue = 0;
|
|
3
|
+
export class ShadowDrawer {
|
|
4
|
+
constructor(engine) {
|
|
5
|
+
this._engine = engine;
|
|
6
|
+
}
|
|
7
|
+
drawBefore(data) {
|
|
8
|
+
const { particle, context } = data, { container } = particle, shadowParticle = particle, shadowEnabled = shadowParticle.shadowEnabled, shadowColor = shadowParticle.shadowColor, shadowOffset = shadowParticle.shadowOffset;
|
|
9
|
+
if (!shadowEnabled || !shadowColor) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
context.shadowBlur = shadowParticle.shadowBlur ?? defaultShadowBlur;
|
|
13
|
+
context.shadowColor = getStyleFromRgb(shadowColor, container.hdr);
|
|
14
|
+
context.shadowOffsetX = shadowOffset?.x ?? defaultShadowOffsetValue;
|
|
15
|
+
context.shadowOffsetY = shadowOffset?.y ?? defaultShadowOffsetValue;
|
|
16
|
+
}
|
|
17
|
+
particleInit(_container, particle) {
|
|
18
|
+
const effectData = particle.effectData;
|
|
19
|
+
if (!effectData?.enable) {
|
|
20
|
+
particle.shadowBlur = undefined;
|
|
21
|
+
particle.shadowColor = undefined;
|
|
22
|
+
particle.shadowOffset = undefined;
|
|
23
|
+
particle.shadowEnabled = false;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const shadowColor = OptionsColor.create(new OptionsColor(), effectData.color);
|
|
27
|
+
particle.shadowColor = rangeColorToRgb(this._engine, shadowColor);
|
|
28
|
+
particle.shadowBlur = effectData.blur;
|
|
29
|
+
particle.shadowOffset = effectData.offset;
|
|
30
|
+
particle.shadowEnabled = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/esm/index.js
ADDED
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/package.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/effect-shadow",
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
|
+
"description": "tsParticles shadow effect",
|
|
5
|
+
"homepage": "https://particles.js.org",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
9
|
+
"directory": "effects/shadow"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"front-end",
|
|
13
|
+
"frontend",
|
|
14
|
+
"tsparticles",
|
|
15
|
+
"particles.js",
|
|
16
|
+
"particlesjs",
|
|
17
|
+
"particles",
|
|
18
|
+
"particle",
|
|
19
|
+
"canvas",
|
|
20
|
+
"jsparticles",
|
|
21
|
+
"xparticles",
|
|
22
|
+
"particles-js",
|
|
23
|
+
"particles-bg",
|
|
24
|
+
"particles-bg-vue",
|
|
25
|
+
"particles-ts",
|
|
26
|
+
"particles.ts",
|
|
27
|
+
"react-particles-js",
|
|
28
|
+
"react-particles.js",
|
|
29
|
+
"react-particles",
|
|
30
|
+
"react",
|
|
31
|
+
"reactjs",
|
|
32
|
+
"vue-particles",
|
|
33
|
+
"ngx-particles",
|
|
34
|
+
"angular-particles",
|
|
35
|
+
"particleground",
|
|
36
|
+
"vue",
|
|
37
|
+
"vuejs",
|
|
38
|
+
"preact",
|
|
39
|
+
"preactjs",
|
|
40
|
+
"jquery",
|
|
41
|
+
"angularjs",
|
|
42
|
+
"angular",
|
|
43
|
+
"typescript",
|
|
44
|
+
"javascript",
|
|
45
|
+
"animation",
|
|
46
|
+
"web",
|
|
47
|
+
"html5",
|
|
48
|
+
"web-design",
|
|
49
|
+
"webdesign",
|
|
50
|
+
"css",
|
|
51
|
+
"html",
|
|
52
|
+
"css3",
|
|
53
|
+
"animated",
|
|
54
|
+
"background",
|
|
55
|
+
"confetti",
|
|
56
|
+
"canvas",
|
|
57
|
+
"fireworks",
|
|
58
|
+
"fireworks-js",
|
|
59
|
+
"confetti-js",
|
|
60
|
+
"confettijs",
|
|
61
|
+
"fireworksjs",
|
|
62
|
+
"canvas-confetti",
|
|
63
|
+
"tsparticles-effect"
|
|
64
|
+
],
|
|
65
|
+
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/tsparticles/tsparticles/issues"
|
|
69
|
+
},
|
|
70
|
+
"funding": [
|
|
71
|
+
{
|
|
72
|
+
"type": "github",
|
|
73
|
+
"url": "https://github.com/sponsors/matteobruni"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "github",
|
|
77
|
+
"url": "https://github.com/sponsors/tsparticles"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "buymeacoffee",
|
|
81
|
+
"url": "https://www.buymeacoffee.com/matteobruni"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"sideEffects": false,
|
|
85
|
+
"jsdelivr": "tsparticles.effect.shadow.min.js",
|
|
86
|
+
"unpkg": "tsparticles.effect.shadow.min.js",
|
|
87
|
+
"browser": "browser/index.js",
|
|
88
|
+
"main": "cjs/index.js",
|
|
89
|
+
"module": "esm/index.js",
|
|
90
|
+
"types": "types/index.d.ts",
|
|
91
|
+
"exports": {
|
|
92
|
+
".": {
|
|
93
|
+
"types": "./types/index.d.ts",
|
|
94
|
+
"browser": "./browser/index.js",
|
|
95
|
+
"import": "./esm/index.js",
|
|
96
|
+
"require": "./cjs/index.js",
|
|
97
|
+
"umd": "./umd/index.js",
|
|
98
|
+
"default": "./cjs/index.js"
|
|
99
|
+
},
|
|
100
|
+
"./package.json": "./package.json"
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"@tsparticles/engine": "4.0.0-alpha.0"
|
|
104
|
+
},
|
|
105
|
+
"publishConfig": {
|
|
106
|
+
"access": "public"
|
|
107
|
+
},
|
|
108
|
+
"type": "module"
|
|
109
|
+
}
|