@supermousejs/trail 2.3.1 → 2.4.1
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/README.md +1 -1
- package/dist/index.mjs +21 -17
- package/dist/index.umd.js +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import { normalize as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
import { normalize as f, definePlugin as p, dom as r, Layers as z } from "@supermousejs/utils";
|
|
2
|
+
const b = (o = {}) => {
|
|
3
|
+
const c = o.length || 10, g = f(o.size, 6), m = f(o.color, "#ff00ff"), a = [], s = [];
|
|
4
4
|
return p(
|
|
5
5
|
{
|
|
6
|
-
name:
|
|
6
|
+
name: o.name || "trail",
|
|
7
7
|
create: () => {
|
|
8
|
-
a.length = 0,
|
|
9
|
-
const t =
|
|
8
|
+
a.length = 0, s.length = 0;
|
|
9
|
+
const t = r.createActor("div");
|
|
10
10
|
t.style.zIndex = z.TRACE;
|
|
11
|
-
for (let
|
|
12
|
-
const e =
|
|
13
|
-
e.style.position = "absolute", e.style.opacity = String(1 -
|
|
11
|
+
for (let n = 0; n < c; n++) {
|
|
12
|
+
const e = r.createCircle(0, "#000");
|
|
13
|
+
e.style.position = "absolute", e.style.opacity = String(1 - n / c), t.appendChild(e), a.push(e), s.push({ x: -100, y: -100 });
|
|
14
14
|
}
|
|
15
15
|
return t;
|
|
16
16
|
},
|
|
17
17
|
update: (t) => {
|
|
18
|
-
const { x:
|
|
19
|
-
|
|
20
|
-
const u =
|
|
21
|
-
a.forEach((
|
|
22
|
-
const h =
|
|
23
|
-
|
|
18
|
+
const { x: n, y: e } = t.state.smooth;
|
|
19
|
+
s.pop(), s.unshift({ x: n, y: e });
|
|
20
|
+
const u = g(t.state), y = m(t.state);
|
|
21
|
+
a.forEach((l, i) => {
|
|
22
|
+
const h = s[i], x = 1 - i / c, d = u * x;
|
|
23
|
+
r.css(l, {
|
|
24
|
+
width: `${d}px`,
|
|
25
|
+
height: `${d}px`,
|
|
26
|
+
backgroundColor: y
|
|
27
|
+
}), r.setTransform(l, h.x, h.y);
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
|
-
|
|
31
|
+
o
|
|
28
32
|
);
|
|
29
33
|
};
|
|
30
34
|
export {
|
|
31
|
-
|
|
35
|
+
b as Trail
|
|
32
36
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.SupermouseTrail={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@supermousejs/utils")):typeof define=="function"&&define.amd?define(["exports","@supermousejs/utils"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.SupermouseTrail={},t.SupermouseUtils))})(this,(function(t,e){"use strict";const m=(s={})=>{const i=s.length||10,h=e.normalize(s.size,6),p=e.normalize(s.color,"#ff00ff"),d=[],r=[];return e.definePlugin({name:s.name||"trail",create:()=>{d.length=0,r.length=0;const o=e.dom.createActor("div");o.style.zIndex=e.Layers.TRACE;for(let c=0;c<i;c++){const n=e.dom.createCircle(0,"#000");n.style.position="absolute",n.style.opacity=String(1-c/i),o.appendChild(n),d.push(n),r.push({x:-100,y:-100})}return o},update:o=>{const{x:c,y:n}=o.state.smooth;r.pop(),r.unshift({x:c,y:n});const y=h(o.state),g=p(o.state);d.forEach((a,l)=>{const u=r[l],x=1-l/i,f=y*x;e.dom.css(a,{width:`${f}px`,height:`${f}px`,backgroundColor:g}),e.dom.setTransform(a,u.x,u.y)})}},s)};t.Trail=m,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/trail",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"main": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"description": "Generates procedural particles that trail behind your motion",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist",
|
|
9
10
|
"README.md"
|
|
@@ -12,18 +13,18 @@
|
|
|
12
13
|
"url": "https://github.com/Whitestar14/supermouse-js",
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@supermousejs/utils": "2.
|
|
16
|
+
"@supermousejs/utils": "2.4.1"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@supermousejs/core": "2.
|
|
19
|
+
"@supermousejs/core": "2.4.1"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
|
-
"@supermousejs/core": "2.
|
|
22
|
+
"@supermousejs/core": "2.4.1"
|
|
22
23
|
},
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
26
|
"url": "git+https://github.com/Whitestar14/supermouse-js.git",
|
|
26
|
-
"directory": "packages/
|
|
27
|
+
"directory": "packages/trail"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
|
29
30
|
"url": "https://github.com/Whitestar14/supermouse-js/issues"
|