@rtstic.dev/pulse 0.0.55 → 0.0.56
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/form/book-a-demo.js +679 -2
- package/dist/form/index.js +962 -2
- package/dist/form/index.js.map +2 -2
- package/dist/form/pricing.css +2 -0
- package/dist/form/pricing.js +790 -2
- package/dist/form/styles.css +140 -1
- package/dist/global/accordions-v2.js +262 -1
- package/dist/global/accordions.js +237 -1
- package/dist/global/faqs.js +116 -1
- package/dist/global/loader.js +76 -1
- package/dist/global/styles.css +252 -1
- package/dist/home/depth.js +243 -3
- package/dist/home/hero-animation/loader.js +67810 -1397
- package/dist/home/hero-animation/scroll.js +401 -1
- package/dist/home/hero-animation/styles.css +233 -1
- package/dist/home/hero-animation/torch.js +62 -1
- package/dist/home/horizontal-scroll.css +49 -1
- package/dist/home/horizontal-scroll.js +140 -1
- package/dist/home/tabs-v2.js +134 -1
- package/dist/home/tabs.js +163 -1
- package/dist/lever/styles.css +31 -1
- package/dist/marquee/index.js +557 -2
- package/dist/marquee/styles.css +26 -1
- package/dist/slider/freescroll-cards.js +51 -1
- package/dist/slider/freescroll-slider.js +31 -1
- package/dist/slider/testimonial.js +30 -1
- package/package.json +3 -3
package/dist/home/depth.js
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// src/home/depth.ts
|
|
4
|
+
var COLOR_URL = "https://cdn.prod.website-files.com/680cbbaefb50442c848aedf7/6926cf888059f91e69c286e7_IMG_0311.jpg";
|
|
5
|
+
var DEPTH_URL = "https://cdn.prod.website-files.com/680cbbaefb50442c848aedf7/6926cf7fd0f3c3f3276d1575_IMG_0310.png";
|
|
6
|
+
var DEPTH_SCALE = 0.01;
|
|
7
|
+
var MOUSE_SMOOTH = 0.9;
|
|
8
|
+
var IMAGE_SCALE = 0.9;
|
|
9
|
+
var state = {
|
|
10
|
+
gl: null,
|
|
11
|
+
program: null,
|
|
12
|
+
mousePos: { x: 0, y: 0 },
|
|
13
|
+
targetPos: { x: 0, y: 0 },
|
|
14
|
+
textures: { color: null, depth: null },
|
|
15
|
+
animationId: null,
|
|
16
|
+
isLoaded: false,
|
|
17
|
+
imageAspect: 1,
|
|
18
|
+
canvasAspect: 1,
|
|
19
|
+
uvScale: { x: 1, y: 1 },
|
|
20
|
+
uvOffset: { x: 0, y: 0 }
|
|
21
|
+
};
|
|
22
|
+
var wrapper = document.getElementById("viewer-wrapper");
|
|
23
|
+
var canvas = document.getElementById("viewer-canvas");
|
|
24
|
+
var statusEl = document.getElementById("status");
|
|
25
|
+
canvas.addEventListener("mousemove", (e) => {
|
|
26
|
+
const rect = canvas.getBoundingClientRect();
|
|
27
|
+
const x = ((e.clientX - rect.left) / rect.width - 0.5) * 2;
|
|
28
|
+
const y = -((e.clientY - rect.top) / rect.height - 0.5) * 2;
|
|
29
|
+
state.targetPos.x = x;
|
|
30
|
+
state.targetPos.y = y;
|
|
31
|
+
});
|
|
32
|
+
canvas.addEventListener("mouseleave", () => {
|
|
33
|
+
state.targetPos.x = 0;
|
|
34
|
+
state.targetPos.y = 0;
|
|
35
|
+
});
|
|
36
|
+
function updateCanvasSize() {
|
|
37
|
+
canvas.width = wrapper.clientWidth;
|
|
38
|
+
canvas.height = wrapper.clientHeight;
|
|
39
|
+
if (state.gl) {
|
|
40
|
+
state.gl.viewport(0, 0, canvas.width, canvas.height);
|
|
41
|
+
updateUvScale();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function updateUvScale() {
|
|
45
|
+
state.canvasAspect = canvas.width / canvas.height;
|
|
46
|
+
const ia = state.imageAspect || 1;
|
|
47
|
+
const ca = state.canvasAspect || 1;
|
|
48
|
+
let scaleX = 1;
|
|
49
|
+
let scaleY = 1;
|
|
50
|
+
let offsetX = 0;
|
|
51
|
+
let offsetY = 0;
|
|
52
|
+
if (ca > ia) {
|
|
53
|
+
scaleX = ca / ia;
|
|
54
|
+
offsetX = (scaleX - 1) / 2;
|
|
55
|
+
} else {
|
|
56
|
+
scaleY = ia / ca;
|
|
57
|
+
offsetY = (scaleY - 1) / 2;
|
|
58
|
+
}
|
|
59
|
+
state.uvScale.x = scaleX;
|
|
60
|
+
state.uvScale.y = scaleY;
|
|
61
|
+
state.uvOffset.x = offsetX;
|
|
62
|
+
state.uvOffset.y = offsetY;
|
|
63
|
+
}
|
|
64
|
+
function initWebGL() {
|
|
65
|
+
updateCanvasSize();
|
|
66
|
+
const gl = canvas.getContext("webgl");
|
|
67
|
+
if (!gl) {
|
|
68
|
+
statusEl.textContent = "WebGL not supported in this browser.";
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
state.gl = gl;
|
|
72
|
+
const vertexShaderSource = `
|
|
2
73
|
attribute vec2 a_position;
|
|
3
74
|
attribute vec2 a_texCoord;
|
|
4
75
|
varying vec2 v_texCoord;
|
|
@@ -6,7 +77,8 @@
|
|
|
6
77
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
7
78
|
v_texCoord = a_texCoord;
|
|
8
79
|
}
|
|
9
|
-
|
|
80
|
+
`;
|
|
81
|
+
const fragmentShaderSource = `
|
|
10
82
|
precision mediump float;
|
|
11
83
|
uniform sampler2D u_colorTexture;
|
|
12
84
|
uniform sampler2D u_depthTexture;
|
|
@@ -36,4 +108,172 @@
|
|
|
36
108
|
gl_FragColor = texture2D(u_colorTexture, uv);
|
|
37
109
|
}
|
|
38
110
|
}
|
|
39
|
-
`;
|
|
111
|
+
`;
|
|
112
|
+
function compileShader(glContext, source, type) {
|
|
113
|
+
const shader = glContext.createShader(type);
|
|
114
|
+
if (!shader) return null;
|
|
115
|
+
glContext.shaderSource(shader, source);
|
|
116
|
+
glContext.compileShader(shader);
|
|
117
|
+
if (!glContext.getShaderParameter(shader, glContext.COMPILE_STATUS)) {
|
|
118
|
+
console.error(glContext.getShaderInfoLog(shader));
|
|
119
|
+
glContext.deleteShader(shader);
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
return shader;
|
|
123
|
+
}
|
|
124
|
+
const vertexShader = compileShader(gl, vertexShaderSource, gl.VERTEX_SHADER);
|
|
125
|
+
const fragmentShader = compileShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
|
|
126
|
+
if (!vertexShader || !fragmentShader) return;
|
|
127
|
+
const program = gl.createProgram();
|
|
128
|
+
if (!program) return;
|
|
129
|
+
gl.attachShader(program, vertexShader);
|
|
130
|
+
gl.attachShader(program, fragmentShader);
|
|
131
|
+
gl.linkProgram(program);
|
|
132
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
133
|
+
console.error(gl.getProgramInfoLog(program));
|
|
134
|
+
statusEl.textContent = "Error linking WebGL program.";
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
state.program = program;
|
|
138
|
+
const positionBuffer = gl.createBuffer();
|
|
139
|
+
if (!positionBuffer) return;
|
|
140
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
141
|
+
gl.bufferData(
|
|
142
|
+
gl.ARRAY_BUFFER,
|
|
143
|
+
new Float32Array([
|
|
144
|
+
-1,
|
|
145
|
+
-1,
|
|
146
|
+
1,
|
|
147
|
+
-1,
|
|
148
|
+
-1,
|
|
149
|
+
1,
|
|
150
|
+
-1,
|
|
151
|
+
1,
|
|
152
|
+
1,
|
|
153
|
+
-1,
|
|
154
|
+
1,
|
|
155
|
+
1
|
|
156
|
+
]),
|
|
157
|
+
gl.STATIC_DRAW
|
|
158
|
+
);
|
|
159
|
+
const texCoordBuffer = gl.createBuffer();
|
|
160
|
+
if (!texCoordBuffer) return;
|
|
161
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
|
|
162
|
+
gl.bufferData(
|
|
163
|
+
gl.ARRAY_BUFFER,
|
|
164
|
+
new Float32Array([
|
|
165
|
+
0,
|
|
166
|
+
1,
|
|
167
|
+
1,
|
|
168
|
+
1,
|
|
169
|
+
0,
|
|
170
|
+
0,
|
|
171
|
+
0,
|
|
172
|
+
0,
|
|
173
|
+
1,
|
|
174
|
+
1,
|
|
175
|
+
1,
|
|
176
|
+
0
|
|
177
|
+
]),
|
|
178
|
+
gl.STATIC_DRAW
|
|
179
|
+
);
|
|
180
|
+
state.positionBuffer = positionBuffer;
|
|
181
|
+
state.texCoordBuffer = texCoordBuffer;
|
|
182
|
+
loadTextures();
|
|
183
|
+
}
|
|
184
|
+
function loadTexture(gl, url, onLoaded, onImageLoaded) {
|
|
185
|
+
const texture = gl.createTexture();
|
|
186
|
+
if (!texture) return null;
|
|
187
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
188
|
+
gl.texImage2D(
|
|
189
|
+
gl.TEXTURE_2D,
|
|
190
|
+
0,
|
|
191
|
+
gl.RGBA,
|
|
192
|
+
1,
|
|
193
|
+
1,
|
|
194
|
+
0,
|
|
195
|
+
gl.RGBA,
|
|
196
|
+
gl.UNSIGNED_BYTE,
|
|
197
|
+
new Uint8Array([0, 0, 0, 255])
|
|
198
|
+
);
|
|
199
|
+
const image = new Image();
|
|
200
|
+
image.crossOrigin = "anonymous";
|
|
201
|
+
image.onload = () => {
|
|
202
|
+
if (onImageLoaded) onImageLoaded(image);
|
|
203
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
204
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
205
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
206
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
207
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
208
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
209
|
+
onLoaded();
|
|
210
|
+
};
|
|
211
|
+
image.onerror = () => {
|
|
212
|
+
statusEl.textContent = "Error loading image: " + url;
|
|
213
|
+
};
|
|
214
|
+
image.src = url;
|
|
215
|
+
return texture;
|
|
216
|
+
}
|
|
217
|
+
function loadTextures() {
|
|
218
|
+
const gl = state.gl;
|
|
219
|
+
if (!gl) return;
|
|
220
|
+
let loadedCount = 0;
|
|
221
|
+
function onLoaded() {
|
|
222
|
+
loadedCount += 1;
|
|
223
|
+
if (loadedCount === 2 && gl) {
|
|
224
|
+
gl.viewport(0, 0, canvas.width, canvas.height);
|
|
225
|
+
state.isLoaded = true;
|
|
226
|
+
statusEl.textContent = "Move your mouse over the image to see the 3D parallax effect.";
|
|
227
|
+
render();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
state.textures.color = loadTexture(
|
|
231
|
+
gl,
|
|
232
|
+
COLOR_URL,
|
|
233
|
+
onLoaded,
|
|
234
|
+
(image) => {
|
|
235
|
+
state.imageAspect = image.width / image.height;
|
|
236
|
+
updateUvScale();
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
state.textures.depth = loadTexture(gl, DEPTH_URL, onLoaded);
|
|
240
|
+
}
|
|
241
|
+
function render() {
|
|
242
|
+
if (!state.isLoaded) return;
|
|
243
|
+
const gl = state.gl;
|
|
244
|
+
const program = state.program;
|
|
245
|
+
if (!gl || !program) return;
|
|
246
|
+
state.mousePos.x += (state.targetPos.x - state.mousePos.x) * MOUSE_SMOOTH;
|
|
247
|
+
state.mousePos.y += (state.targetPos.y - state.mousePos.y) * MOUSE_SMOOTH;
|
|
248
|
+
gl.clearColor(0, 0, 0, 1);
|
|
249
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
250
|
+
gl.useProgram(program);
|
|
251
|
+
const positionLocation = gl.getAttribLocation(program, "a_position");
|
|
252
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, state.positionBuffer);
|
|
253
|
+
gl.enableVertexAttribArray(positionLocation);
|
|
254
|
+
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
|
|
255
|
+
const texCoordLocation = gl.getAttribLocation(program, "a_texCoord");
|
|
256
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, state.texCoordBuffer);
|
|
257
|
+
gl.enableVertexAttribArray(texCoordLocation);
|
|
258
|
+
gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
|
|
259
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
260
|
+
gl.bindTexture(gl.TEXTURE_2D, state.textures.color);
|
|
261
|
+
gl.uniform1i(gl.getUniformLocation(program, "u_colorTexture"), 0);
|
|
262
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
263
|
+
gl.bindTexture(gl.TEXTURE_2D, state.textures.depth);
|
|
264
|
+
gl.uniform1i(gl.getUniformLocation(program, "u_depthTexture"), 1);
|
|
265
|
+
gl.uniform2f(gl.getUniformLocation(program, "u_mouse"), state.mousePos.x, state.mousePos.y);
|
|
266
|
+
gl.uniform1f(gl.getUniformLocation(program, "u_scale"), DEPTH_SCALE);
|
|
267
|
+
gl.uniform2f(gl.getUniformLocation(program, "u_uvScale"), state.uvScale.x, state.uvScale.y);
|
|
268
|
+
gl.uniform2f(gl.getUniformLocation(program, "u_uvOffset"), state.uvOffset.x, state.uvOffset.y);
|
|
269
|
+
gl.uniform1f(gl.getUniformLocation(program, "u_imageScale"), IMAGE_SCALE);
|
|
270
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
271
|
+
state.animationId = requestAnimationFrame(render);
|
|
272
|
+
}
|
|
273
|
+
window.addEventListener("load", initWebGL);
|
|
274
|
+
window.addEventListener("resize", () => {
|
|
275
|
+
if (!state.gl) return;
|
|
276
|
+
updateCanvasSize();
|
|
277
|
+
});
|
|
278
|
+
})();
|
|
279
|
+
//# sourceMappingURL=depth.js.map
|