chrome-polish-button 1.0.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.

Potentially problematic release.


This version of chrome-polish-button might be problematic. Click here for more details.

package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Drag0nSlay
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,63 @@
1
+ # Chrome Polish Button
2
+
3
+ A high-end, interactive skeuomorphic button featuring live camera reflection, dynamic fingerprint heat-maps, hit-line interaction, and metallic sound effect. Built for luxury UI and futuristic web experiences.
4
+
5
+ ---
6
+
7
+ ## Demo
8
+
9
+ - Press the button to see **live camera reflection**.
10
+ - A **hit-line** appears on press.
11
+ - **Fingerprint highlights** animate when pressed.
12
+ - **Metallic click sound** enhances the tactile feel.
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ - Live camera feed reflection inside the button
19
+ - Polished chrome look with highlights and micro-scratches
20
+ - Fingerprint animation
21
+ - Hit-line effect on press
22
+ - Metallic click sound
23
+ - Fully mobile-friendly
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install chrome-polish-button
31
+ ```
32
+
33
+ # Quick Start
34
+
35
+ 1. Import the CSS and the JS module:
36
+
37
+ <!--end list-->
38
+ ```bash
39
+ import ChromeTactileButton from 'chrome-polish-button';
40
+ import 'chrome-polish-button/style.css';
41
+
42
+ new ChromeTactileButton('#my-button', { label: "ACTIVATE", soundSrc: "path/to/your/sound.wav" });
43
+ ```
44
+
45
+ 2. Add the HTML element:
46
+ <!--end list-->
47
+ ```bash
48
+ <div id="my-button"></div>
49
+ ```
50
+
51
+ > The camera reflection is process entirely on the client-side. No video data is recorded or transmitted. This library requires HTTPS for camera access in production.
52
+
53
+ ---
54
+
55
+ ## Usage
56
+ - Move your cursor (or finger on mobile) over the button to see dynamic reflection highlights.
57
+ - Press the button to see hit-line + fingerprint animation and hear the metallic click.
58
+
59
+ ## Technologies
60
+
61
+ - HTML5 <canvas>
62
+ - CSS3 (transitions, gradients, blend modes)
63
+ - JavaScript (DOM manipulation, MediaDevices API)
Binary file
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "chrome-polish-button",
3
+ "version": "1.0.0",
4
+ "description": "A high-end skeuomorphic button with live camera reflection and tactile feedback.",
5
+ "main": "script.js",
6
+ "files": [
7
+ "script.js",
8
+ "style.css",
9
+ "mixkit-metal-tool-drop-835.wav"
10
+ ],
11
+ "keywords": [
12
+ "ui", "button", "chrome", "skeuomorphism", "camera-reflection", "tactile"
13
+ ],
14
+ "author": "Drag0nSlay",
15
+ "license": "MIT"
16
+ }
package/script.js ADDED
@@ -0,0 +1,115 @@
1
+ export default class ChromeTactileButton {
2
+ constructor(elementId, options = {}) {
3
+ this.container = document.querySelector(elementId);
4
+ if (!this.container) return;
5
+
6
+ this.config = {
7
+ label: options.label || "PUSH",
8
+ soundSrc: options.soundSrc || "mixkit-metal-tool-drop-835.wav"
9
+ };
10
+
11
+ this.highlightX = null;
12
+ this.init();
13
+ }
14
+
15
+ init() {
16
+ this.container.classList.add('chrome-btn-container');
17
+ this.container.innerHTML = `
18
+ <canvas class="chrome-canvas"></canvas>
19
+ <div class="chrome-label">${this.config.label}</div>
20
+ <div class="chrome-fingerprint"></div>
21
+ <div class="chrome-hit-line"></div>
22
+ `;
23
+
24
+ this.canvas = this.container.querySelector('.chrome-canvas');
25
+ this.ctx = this.canvas.getContext('2d');
26
+ this.hitLine = this.container.querySelector('.chrome-hit-line');
27
+ this.fingerprint = this.container.querySelector('.chrome-fingerprint');
28
+
29
+ this.canvas.width = 320;
30
+ this.canvas.height = 140;
31
+
32
+ this.audio = new Audio(this.config.soundSrc);
33
+ this.video = document.createElement("video");
34
+ this.video.setAttribute('autoplay', '');
35
+ this.video.setAttribute('muted', '');
36
+ this.video.setAttribute('playsinline', '');
37
+
38
+ this.startCamera();
39
+ this.bindEvents();
40
+ this.animate();
41
+ }
42
+
43
+ async startCamera() {
44
+ try {
45
+ const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: "user" } });
46
+ this.video.srcObject = stream;
47
+ await this.video.play();
48
+ } catch (e) { console.warn("Camera failed", e); }
49
+ }
50
+
51
+ bindEvents() {
52
+ const getCoords = (e) => {
53
+ const r = this.container.getBoundingClientRect();
54
+ const x = (e.touches ? e.touches[0].clientX : e.clientX) - r.left;
55
+ const y = (e.touches ? e.touches[0].clientY : e.clientY) - r.top;
56
+ return { x, y };
57
+ };
58
+
59
+ this.container.addEventListener("pointermove", (e) => {
60
+ this.highlightX = getCoords(e).x;
61
+ });
62
+
63
+ this.container.addEventListener("pointerdown", (e) => {
64
+ this.container.classList.add('is-pressed');
65
+ this.audio.currentTime = 0;
66
+ this.audio.play().catch(()=>{});
67
+
68
+ const { x, y } = getCoords(e);
69
+
70
+ this.hitLine.style.left = `${x}px`;
71
+ this.hitLine.classList.remove('active');
72
+ void this.hitLine.offsetWidth;
73
+ this.hitLine.classList.add('active');
74
+
75
+ this.fingerprint.style.left = `${x}px`;
76
+ this.fingerprint.style.top = `${y}px`;
77
+
78
+ this.container.classList.remove('animating-fp');
79
+ void this.container.offsetWidth;
80
+ this.container.classList.add('animating-fp');
81
+ });
82
+
83
+ const release = () => this.container.classList.remove('is-pressed');
84
+ window.addEventListener("pointerup", release);
85
+ window.addEventListener("pointercancel", release);
86
+ }
87
+
88
+ draw() {
89
+ const { ctx, canvas, video, highlightX } = this;
90
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
91
+
92
+ ctx.save();
93
+ ctx.globalAlpha = 0.55;
94
+ ctx.filter = "blur(3px) contrast(1.2) brightness(1.1) saturate(1.3)";
95
+ ctx.translate(canvas.width, 0);
96
+ ctx.scale(-1, 1);
97
+ ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
98
+ ctx.restore();
99
+
100
+ if (highlightX !== null) {
101
+ const p = highlightX / canvas.width;
102
+ const g = ctx.createLinearGradient(0, 0, canvas.width, 0);
103
+ g.addColorStop(0, "rgba(255,255,255,0)");
104
+ g.addColorStop(p, "rgba(255,255,255,0.7)");
105
+ g.addColorStop(1, "rgba(255,255,255,0)");
106
+ ctx.fillStyle = g;
107
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
108
+ }
109
+ }
110
+
111
+ animate() {
112
+ this.draw();
113
+ requestAnimationFrame(() => this.animate());
114
+ }
115
+ }
package/style.css ADDED
@@ -0,0 +1,85 @@
1
+ .chrome-btn-container {
2
+ width: 320px;
3
+ height: 140px;
4
+ border-radius: 70px;
5
+ position: relative;
6
+ overflow: hidden;
7
+ cursor: pointer;
8
+
9
+ outline: none;
10
+ -webkit-tap-highlight-color: transparent;
11
+ user-select: none;
12
+ touch-action: manipulation;
13
+
14
+ transition: transform .1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow .1s ease;
15
+ box-shadow:
16
+ inset 0 6px 12px rgba(255,255,255,.9),
17
+ inset 0 -8px 14px rgba(0,0,0,.25),
18
+ 0 20px 40px rgba(0,0,0,.3);
19
+ z-index: 1;
20
+ }
21
+
22
+ .chrome-btn-container.is-pressed {
23
+ transform: translateY(4px) scale(.97);
24
+ box-shadow:
25
+ inset 0 3px 6px rgba(255,255,255,.6),
26
+ inset 0 -4px 8px rgba(0,0,0,.35),
27
+ 0 8px 18px rgba(0,0,0,.25);
28
+ }
29
+
30
+ .chrome-canvas {
31
+ width: 100%;
32
+ height: 100%;
33
+ display: block;
34
+ background: #ccc;
35
+ }
36
+
37
+ .chrome-label {
38
+ position: absolute;
39
+ inset: 0;
40
+ display: flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ font-size: 32px;
44
+ font-weight: 700;
45
+ color: #cfcfcf;
46
+ pointer-events: none;
47
+ mix-blend-mode: overlay;
48
+ text-shadow: 1px 1px 2px rgba(255,255,255,.9), -1px -1px 2px rgba(0,0,0,.5);
49
+ }
50
+
51
+ .chrome-fingerprint {
52
+ position: absolute;
53
+ inset: 0;
54
+ background: radial-gradient(circle at center, rgba(255,255,255,0.95), transparent 70%);
55
+ opacity: 0;
56
+ pointer-events: none;
57
+ }
58
+
59
+ .chrome-btn-container.animating-fp .chrome-fingerprint {
60
+ animation: heat-up 5s ease-out forwards;
61
+ }
62
+
63
+ @keyframes heat-up {
64
+ 0% { opacity: 1; filter: blur(0); }
65
+ 100% { opacity: 0; filter: blur(8px); }
66
+ }
67
+
68
+ .chrome-hit-line {
69
+ position: absolute;
70
+ width: 2px;
71
+ height: 100%;
72
+ background: white;
73
+ top: 0;
74
+ opacity: 0;
75
+ pointer-events: none;
76
+ }
77
+
78
+ .chrome-hit-line.active {
79
+ animation: flash 0.4s ease-out;
80
+ }
81
+
82
+ @keyframes flash {
83
+ 0% { opacity: 1; }
84
+ 100% { opacity: 0; }
85
+ }