destroy-the-text 3.2.1 → 3.2.3
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/dist/Letra.d.ts.map +1 -1
- package/dist/Letra.js +20 -5
- package/dist/Pixel.d.ts.map +1 -1
- package/dist/Pixel.js +17 -4
- package/dist/Spark.d.ts.map +1 -1
- package/dist/Spark.js +16 -3
- package/package.json +1 -1
package/dist/Letra.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Letra.d.ts","sourceRoot":"","sources":["../src/Letra.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IACd,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAsB;gBAE3B,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"Letra.d.ts","sourceRoot":"","sources":["../src/Letra.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IACd,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAsB;gBAE3B,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG;IA0BhD,MAAM;IAyBN,OAAO,IAAI,OAAO;IAIlB,OAAO,CAAC,qBAAqB;CAGhC"}
|
package/dist/Letra.js
CHANGED
|
@@ -14,18 +14,33 @@ export class Letra {
|
|
|
14
14
|
this.container.css("font-size", container.parent().css("font-size"));
|
|
15
15
|
this.container.css("font-weight", container.parent().css("font-weight"));
|
|
16
16
|
this.container.css("font-family", container.parent().css("font-family"));
|
|
17
|
-
|
|
18
|
-
this.container
|
|
17
|
+
// Use native DOM API for transform
|
|
18
|
+
const element = this.container[0];
|
|
19
|
+
element.style.transform = `translate(${x}px, ${y}px)`;
|
|
20
|
+
element.style.willChange = "transform";
|
|
19
21
|
$("body").append(this.container);
|
|
20
|
-
|
|
22
|
+
// Initial upward velocity, then gravity pulls down
|
|
23
|
+
this.direction = { x: this.getPositiveOrNegative() * Math.random() * 2, y: -3 };
|
|
24
|
+
this.gravitySpeed = 0;
|
|
21
25
|
// Register with global animation manager
|
|
22
26
|
AnimationManager.register(this);
|
|
23
27
|
}
|
|
24
28
|
update() {
|
|
25
29
|
this.gravitySpeed += 0.2;
|
|
26
|
-
this.y += this.gravitySpeed;
|
|
30
|
+
this.y += this.gravitySpeed + this.direction.y;
|
|
27
31
|
this.x += this.direction.x;
|
|
28
|
-
|
|
32
|
+
// Fade out effect near end of life
|
|
33
|
+
const timeAlive = Date.now() - this.startTime;
|
|
34
|
+
const fadeOutStart = this.lifespan * 0.7;
|
|
35
|
+
if (timeAlive > fadeOutStart) {
|
|
36
|
+
const fadeOutDuration = this.lifespan - fadeOutStart;
|
|
37
|
+
const fadeProgress = (timeAlive - fadeOutStart) / fadeOutDuration;
|
|
38
|
+
const opacity = Math.max(0, 1 - fadeProgress);
|
|
39
|
+
this.container.css("opacity", opacity.toString());
|
|
40
|
+
}
|
|
41
|
+
// Use native DOM API for transform
|
|
42
|
+
const element = this.container[0];
|
|
43
|
+
element.style.transform = `translate(${this.x}px, ${this.y}px)`;
|
|
29
44
|
// Auto-cleanup when dead
|
|
30
45
|
if (!this.isAlive()) {
|
|
31
46
|
this.container.remove();
|
package/dist/Pixel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../src/Pixel.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IACd,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAsB;IACvC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,CAAM;IAClC,MAAM,CAAC,UAAU,SAAO;gBAEZ,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../src/Pixel.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IACd,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAsB;IACvC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,CAAM;IAClC,MAAM,CAAC,UAAU,SAAO;gBAEZ,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IA8B/C,MAAM;IAiCN,OAAO,IAAI,OAAO;IAIlB,OAAO,CAAC,qBAAqB;IAItB,OAAO;CAGjB"}
|
package/dist/Pixel.js
CHANGED
|
@@ -11,10 +11,12 @@ export class Pixel {
|
|
|
11
11
|
this.container = $(document.createElement("div"));
|
|
12
12
|
this.container.addClass("pixel");
|
|
13
13
|
this.container.css("background", color);
|
|
14
|
-
|
|
15
|
-
this.container
|
|
14
|
+
// Use native DOM API for transform to avoid jQuery issues
|
|
15
|
+
const element = this.container[0];
|
|
16
|
+
element.style.transform = `translate(${this.x}px, ${this.y}px)`;
|
|
17
|
+
element.style.willChange = "transform";
|
|
16
18
|
$("body").append(this.container);
|
|
17
|
-
console.log("🎯 Pixel created at", { x: this.x, y: this.y, color, element: this.container[0] });
|
|
19
|
+
console.log("🎯 Pixel created at", { x: this.x, y: this.y, color, element: this.container[0], transform: element.style.transform });
|
|
18
20
|
this.direction = { x: this.getPositiveOrNegative() * Math.random(), y: 0 };
|
|
19
21
|
Pixel.activePixels.push(this);
|
|
20
22
|
if (Pixel.activePixels.length > Pixel.MAX_PIXELS) {
|
|
@@ -35,7 +37,18 @@ export class Pixel {
|
|
|
35
37
|
this.direction.x = 0;
|
|
36
38
|
this.container.css("opacity", "0.8");
|
|
37
39
|
}
|
|
38
|
-
|
|
40
|
+
// Fade out effect near end of life
|
|
41
|
+
const timeAlive = Date.now() - this.startTime;
|
|
42
|
+
const fadeOutStart = this.lifespan * 0.7; // Start fade out at 70% of lifespan
|
|
43
|
+
if (timeAlive > fadeOutStart) {
|
|
44
|
+
const fadeOutDuration = this.lifespan - fadeOutStart;
|
|
45
|
+
const fadeProgress = (timeAlive - fadeOutStart) / fadeOutDuration;
|
|
46
|
+
const opacity = Math.max(0, 1 - fadeProgress);
|
|
47
|
+
this.container.css("opacity", opacity.toString());
|
|
48
|
+
}
|
|
49
|
+
// Use native DOM API for transform
|
|
50
|
+
const element = this.container[0];
|
|
51
|
+
element.style.transform = `translate(${this.x}px, ${this.y}px)`;
|
|
39
52
|
// Auto-cleanup when dead
|
|
40
53
|
if (!this.isAlive()) {
|
|
41
54
|
this.destroy();
|
package/dist/Spark.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spark.d.ts","sourceRoot":"","sources":["../src/Spark.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IAChB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,CAAM;IAClC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAsB;gBAE3B,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"Spark.d.ts","sourceRoot":"","sources":["../src/Spark.ts"],"names":[],"mappings":"AAGA,qBAAa,KAAK;IAChB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAAa;IACjC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,CAAM;IAClC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAsB;gBAE3B,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAsChC,MAAM;IAyBN,OAAO,IAAI,OAAO;IAIX,OAAO;CAOf"}
|
package/dist/Spark.js
CHANGED
|
@@ -17,9 +17,11 @@ export class Spark {
|
|
|
17
17
|
height: "3px",
|
|
18
18
|
boxShadow: `0 0 4px ${color}`,
|
|
19
19
|
zIndex: 100,
|
|
20
|
-
transform: `translate(${x}px, ${y}px)`,
|
|
21
|
-
"will-change": "transform",
|
|
22
20
|
});
|
|
21
|
+
// Use native DOM API for transform
|
|
22
|
+
const element = this.container[0];
|
|
23
|
+
element.style.transform = `translate(${x}px, ${y}px)`;
|
|
24
|
+
element.style.willChange = "transform";
|
|
23
25
|
$("body").append(this.container);
|
|
24
26
|
const angle = Math.random() * Math.PI * 2;
|
|
25
27
|
const speed = 2 + Math.random() * 3;
|
|
@@ -35,7 +37,18 @@ export class Spark {
|
|
|
35
37
|
this.gravitySpeed += 0.1;
|
|
36
38
|
this.y += this.gravitySpeed + this.direction.y;
|
|
37
39
|
this.x += this.direction.x;
|
|
38
|
-
|
|
40
|
+
// Fade out effect
|
|
41
|
+
const timeAlive = Date.now() - this.startTime;
|
|
42
|
+
const fadeOutStart = this.lifespan * 0.6;
|
|
43
|
+
if (timeAlive > fadeOutStart) {
|
|
44
|
+
const fadeOutDuration = this.lifespan - fadeOutStart;
|
|
45
|
+
const fadeProgress = (timeAlive - fadeOutStart) / fadeOutDuration;
|
|
46
|
+
const opacity = Math.max(0, 1 - fadeProgress);
|
|
47
|
+
this.container.css("opacity", opacity.toString());
|
|
48
|
+
}
|
|
49
|
+
// Use native DOM API for transform
|
|
50
|
+
const element = this.container[0];
|
|
51
|
+
element.style.transform = `translate(${this.x}px, ${this.y}px)`;
|
|
39
52
|
// Auto-cleanup when dead
|
|
40
53
|
if (!this.isAlive()) {
|
|
41
54
|
this.destroy();
|