@supermousejs/trail 2.3.1 → 2.4.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @supermousejs/trail
2
2
 
3
- Generates procedural particles that trail behind your motion.
3
+ Generates procedural particles that trail behind your motion
4
4
 
5
5
  ## Installation
6
6
 
package/dist/index.mjs CHANGED
@@ -1,32 +1,36 @@
1
- import { normalize as d, definePlugin as p, dom as o, Layers as z } from "@supermousejs/utils";
2
- const C = (s = {}) => {
3
- const l = s.length || 10, f = d(s.size, 6), m = d(s.color, "#ff00ff"), a = [], n = [];
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: s.name || "trail",
6
+ name: o.name || "trail",
7
7
  create: () => {
8
- a.length = 0, n.length = 0;
9
- const t = o.createActor("div");
8
+ a.length = 0, s.length = 0;
9
+ const t = r.createActor("div");
10
10
  t.style.zIndex = z.TRACE;
11
- for (let r = 0; r < l; r++) {
12
- const e = o.createCircle(0, "#000");
13
- e.style.position = "absolute", e.style.opacity = String(1 - r / l), t.appendChild(e), a.push(e), n.push({ x: -100, y: -100 });
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: r, y: e } = t.state.smooth;
19
- n.pop(), n.unshift({ x: r, y: e });
20
- const u = f(t.state), g = m(t.state);
21
- a.forEach((c, i) => {
22
- const h = n[i], x = 1 - i / l, y = u * x;
23
- o.setStyle(c, "width", `${y}px`), o.setStyle(c, "height", `${y}px`), o.setStyle(c, "backgroundColor", g), o.setTransform(c, h.x, h.y);
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
- s
31
+ o
28
32
  );
29
33
  };
30
34
  export {
31
- C as Trail
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 u=(s={})=>{const d=s.length||10,h=e.normalize(s.size,6),y=e.normalize(s.color,"#ff00ff"),a=[],r=[];return e.definePlugin({name:s.name||"trail",create:()=>{a.length=0,r.length=0;const o=e.dom.createActor("div");o.style.zIndex=e.Layers.TRACE;for(let c=0;c<d;c++){const n=e.dom.createCircle(0,"#000");n.style.position="absolute",n.style.opacity=String(1-c/d),o.appendChild(n),a.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 p=h(o.state),S=y(o.state);a.forEach((i,l)=>{const f=r[l],g=1-l/d,m=p*g;e.dom.setStyle(i,"width",`${m}px`),e.dom.setStyle(i,"height",`${m}px`),e.dom.setStyle(i,"backgroundColor",S),e.dom.setTransform(i,f.x,f.y)})}},s)};t.Trail=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
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.1",
3
+ "version": "2.4.0",
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,13 +13,13 @@
12
13
  "url": "https://github.com/Whitestar14/supermouse-js",
13
14
  "license": "MIT",
14
15
  "dependencies": {
15
- "@supermousejs/utils": "2.3.1"
16
+ "@supermousejs/utils": "2.4.0"
16
17
  },
17
18
  "devDependencies": {
18
- "@supermousejs/core": "2.3.0"
19
+ "@supermousejs/core": "2.4.0"
19
20
  },
20
21
  "peerDependencies": {
21
- "@supermousejs/core": "2.3.0"
22
+ "@supermousejs/core": "2.4.0"
22
23
  },
23
24
  "repository": {
24
25
  "type": "git",