@gudhub/ssg-web-components-library 1.0.116 → 1.0.118
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/package.json +1 -1
- package/src/components/get-in-touch-form/get-in-touch-form.html +0 -3
- package/src/components/get-in-touch-form/get-in-touch-form.js +16 -72
- package/src/components/get-in-touch-form/get-in-touch-form.scss +0 -12
- package/src/components/liqpay-component/config.js +6 -0
- package/src/components/liqpay-component/liqpay-component.html +91 -0
- package/src/components/liqpay-component/liqpay-component.js +197 -0
- package/src/components/liqpay-component/liqpay-component.json +14 -0
- package/src/components/liqpay-component/liqpay-component.md +0 -0
- package/src/components/liqpay-component/liqpay-component.scss +337 -0
- package/src/components/liqpay-payment-button/config.js +6 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.html +5 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.js +23 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.json +4 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.md +0 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.scss +7 -0
- package/src/components/masonry-gallery/masonry-gallery.js +68 -24
- package/src/components/video-slider/animations/cascade-strips.js +89 -0
- package/src/components/video-slider/animations/fade.js +31 -0
- package/src/components/video-slider/animations/multi-strip.js +66 -0
- package/src/components/video-slider/animations/sectors.js +104 -0
- package/src/components/video-slider/animations/wipe-left.js +43 -0
- package/src/components/video-slider/animations/zoom.js +51 -0
- package/src/components/video-slider/config.js +6 -0
- package/src/components/video-slider/utils/draw-image-cover.js +27 -0
- package/src/components/video-slider/utils/easing.js +5 -0
- package/src/components/video-slider/video-slider.html +5 -0
- package/src/components/video-slider/video-slider.js +177 -0
- package/src/components/video-slider/video-slider.readme.md +218 -0
- package/src/components/video-slider/video-slider.scss +16 -0
- package/src/config.js +1 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
body {
|
|
2
|
+
padding-top: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
liqpay-component {
|
|
6
|
+
display: block;
|
|
7
|
+
|
|
8
|
+
.liqpay-component {
|
|
9
|
+
position: relative;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
padding: 48px 20px 80px;
|
|
12
|
+
background:
|
|
13
|
+
radial-gradient(ellipse 80% 60% at 15% 50%, rgba(29, 78, 216, 0.18) 0%, transparent 70%),
|
|
14
|
+
radial-gradient(ellipse 60% 50% at 85% 50%, rgba(109, 40, 217, 0.14) 0%, transparent 70%),
|
|
15
|
+
linear-gradient(135deg, #0a1628 0%, #0d1f3c 40%, #0e1a35 60%, #0c1525 100%);
|
|
16
|
+
background-attachment: fixed;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
|
|
22
|
+
// &__logo {
|
|
23
|
+
// display: flex;
|
|
24
|
+
// align-items: center;
|
|
25
|
+
// gap: 8px;
|
|
26
|
+
// margin-bottom: 28px;
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// &__logo-badge {
|
|
30
|
+
// background: #1e3a5f;
|
|
31
|
+
// border: 1px solid #2a4f7c;
|
|
32
|
+
// border-radius: 8px;
|
|
33
|
+
// padding: 6px 10px;
|
|
34
|
+
// display: flex;
|
|
35
|
+
// align-items: center;
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
// &__logo-badge-text {
|
|
39
|
+
// display: flex;
|
|
40
|
+
// flex-direction: column;
|
|
41
|
+
// line-height: 1;
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// &__logo-gud {
|
|
45
|
+
// font-size: 17px;
|
|
46
|
+
// font-weight: 700;
|
|
47
|
+
// color: #4a9eff;
|
|
48
|
+
// letter-spacing: 0.02em;
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// &__logo-hub {
|
|
52
|
+
// font-size: 17px;
|
|
53
|
+
// font-weight: 700;
|
|
54
|
+
// color: #4a9eff;
|
|
55
|
+
// letter-spacing: 0.04em;
|
|
56
|
+
// }
|
|
57
|
+
|
|
58
|
+
// &__logo-crm {
|
|
59
|
+
// font-size: 46px;
|
|
60
|
+
// font-weight: 700;
|
|
61
|
+
// color: #ffffff;
|
|
62
|
+
// letter-spacing: -0.3px;
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
&__title {
|
|
66
|
+
margin: 0;
|
|
67
|
+
color: #ffffff;
|
|
68
|
+
font-size: 32px;
|
|
69
|
+
font-weight: 700;
|
|
70
|
+
letter-spacing: -0.5px;
|
|
71
|
+
line-height: 1.2;
|
|
72
|
+
text-align: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__subtitle {
|
|
76
|
+
margin: 10px 0 32px;
|
|
77
|
+
color: #8599b5;
|
|
78
|
+
font-size: 15px;
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
text-align: center;
|
|
81
|
+
line-height: 1.5;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__card {
|
|
85
|
+
width: 100%;
|
|
86
|
+
max-width: 420px;
|
|
87
|
+
background: #eef0f4;
|
|
88
|
+
border-radius: 20px;
|
|
89
|
+
padding: 28px 28px 24px;
|
|
90
|
+
border: none;
|
|
91
|
+
box-shadow: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__amount-row {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
gap: 12px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__amount-label {
|
|
102
|
+
margin: 0 0 4px;
|
|
103
|
+
font-size: 13px;
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
color: #6b7280;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__amount {
|
|
109
|
+
margin: 0;
|
|
110
|
+
font-size: 38px;
|
|
111
|
+
font-weight: 700;
|
|
112
|
+
color: #111827;
|
|
113
|
+
letter-spacing: -1px;
|
|
114
|
+
line-height: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__secured-badge {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 6px;
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
margin-top: 6px;
|
|
123
|
+
background: #ffffff;
|
|
124
|
+
border: 1.5px solid #16a34a;
|
|
125
|
+
border-radius: 100px;
|
|
126
|
+
padding: 5px 12px 5px 7px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__secured-icon {
|
|
130
|
+
width: 18px;
|
|
131
|
+
height: 18px;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
background: #16a34a;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
|
|
139
|
+
svg {
|
|
140
|
+
width: 10px;
|
|
141
|
+
height: 10px;
|
|
142
|
+
display: block;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&__secured-text {
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
font-weight: 600;
|
|
149
|
+
color: #16a34a;
|
|
150
|
+
line-height: 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&__divider {
|
|
154
|
+
height: 1px;
|
|
155
|
+
background: #d4d7de;
|
|
156
|
+
margin: 20px 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&__summary {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 14px;
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
border-radius: 0;
|
|
166
|
+
background: transparent;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__summary-row {
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: flex-start;
|
|
172
|
+
justify-content: space-between;
|
|
173
|
+
gap: 16px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&__summary-label {
|
|
177
|
+
font-size: 14px;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
color: #6b7280;
|
|
180
|
+
flex-shrink: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__summary-value {
|
|
184
|
+
font-size: 14px;
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
color: #111827;
|
|
187
|
+
text-align: right;
|
|
188
|
+
max-width: 60%;
|
|
189
|
+
word-break: break-word;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&__text {
|
|
193
|
+
margin: 16px 0 0;
|
|
194
|
+
color: #6b7280;
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
line-height: 1.6;
|
|
197
|
+
|
|
198
|
+
&:empty {
|
|
199
|
+
display: none;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&__form {
|
|
204
|
+
margin: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&__button {
|
|
208
|
+
display: inline-flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
gap: 10px;
|
|
212
|
+
width: 100%;
|
|
213
|
+
min-height: 52px;
|
|
214
|
+
margin-top: 22px;
|
|
215
|
+
padding: 0 24px;
|
|
216
|
+
border: none;
|
|
217
|
+
border-radius: 12px;
|
|
218
|
+
background: #2563eb;
|
|
219
|
+
color: #ffffff;
|
|
220
|
+
font-size: 16px;
|
|
221
|
+
font-weight: 700;
|
|
222
|
+
letter-spacing: -0.2px;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
transition:
|
|
225
|
+
background 0.18s ease,
|
|
226
|
+
transform 0.1s ease;
|
|
227
|
+
|
|
228
|
+
&:hover {
|
|
229
|
+
background: #1d4ed8;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&:active {
|
|
233
|
+
background: #1e40af;
|
|
234
|
+
transform: scale(0.98);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&:disabled {
|
|
238
|
+
cursor: not-allowed;
|
|
239
|
+
opacity: 0.6;
|
|
240
|
+
transform: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&__button-icon {
|
|
245
|
+
width: 18px;
|
|
246
|
+
height: 18px;
|
|
247
|
+
flex-shrink: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&__error {
|
|
251
|
+
margin: 14px 0 0;
|
|
252
|
+
color: #dc2626;
|
|
253
|
+
font-size: 13px;
|
|
254
|
+
line-height: 1.5;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&__powered {
|
|
258
|
+
margin: 16px 0 0;
|
|
259
|
+
text-align: center;
|
|
260
|
+
font-size: 13px;
|
|
261
|
+
color: #9ca3af;
|
|
262
|
+
font-weight: 400;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&__powered-brand {
|
|
266
|
+
color: #16a34a;
|
|
267
|
+
font-weight: 700;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&__security {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 24px;
|
|
274
|
+
margin-top: 24px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&__security-item {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
gap: 7px;
|
|
281
|
+
font-size: 13px;
|
|
282
|
+
color: #8599b5;
|
|
283
|
+
font-weight: 500;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&__security-icon {
|
|
287
|
+
width: 18px;
|
|
288
|
+
height: 18px;
|
|
289
|
+
border-radius: 50%;
|
|
290
|
+
border: 1.5px solid #16a34a;
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
justify-content: center;
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
|
|
296
|
+
svg {
|
|
297
|
+
width: 10px;
|
|
298
|
+
height: 10px;
|
|
299
|
+
display: block;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@media (max-width: 480px) {
|
|
305
|
+
.liqpay-component {
|
|
306
|
+
padding: 40px 16px 72px;
|
|
307
|
+
|
|
308
|
+
&__title {
|
|
309
|
+
font-size: 26px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&__card {
|
|
313
|
+
padding: 22px 18px 20px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&__amount {
|
|
317
|
+
font-size: 30px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&__summary-row {
|
|
321
|
+
flex-direction: column;
|
|
322
|
+
gap: 4px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&__summary-value {
|
|
326
|
+
max-width: 100%;
|
|
327
|
+
text-align: left;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
&__security {
|
|
331
|
+
flex-direction: column;
|
|
332
|
+
gap: 10px;
|
|
333
|
+
align-items: flex-start;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import html from './liqpay-payment-button.html';
|
|
2
|
+
import './liqpay-payment-button.scss';
|
|
3
|
+
import jsonTemplate from './liqpay-payment-button.json';
|
|
4
|
+
|
|
5
|
+
class liqpayPaymentButton extends window.GHComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
super.setDefaultData(jsonTemplate);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async onServerRender() {
|
|
12
|
+
this.ghId = this.getAttribute('data-gh-id') || null;
|
|
13
|
+
this.json = await super.getGhData(this.ghId, 'areas');
|
|
14
|
+
|
|
15
|
+
console.log("AAAAAAAAAAAAAAAAAAAAAAAA", this.json);
|
|
16
|
+
|
|
17
|
+
if (this.json) {
|
|
18
|
+
super.render(html);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
window.customElements.define('liqpay-payment-button', liqpayPaymentButton);
|
|
File without changes
|
|
@@ -19,6 +19,9 @@ class MasonryGallery extends GHComponent {
|
|
|
19
19
|
this.fitWidthValue = !!this.columnWidthValue;
|
|
20
20
|
this.contactUsButton = this.hasAttribute('data-modal-button') ? this.getAttribute('data-modal-button') : null;
|
|
21
21
|
this.contactUsButtonId = this.hasAttribute('data-modal-button-id') ? this.getAttribute('data-modal-button-id') : null;
|
|
22
|
+
this.showCount = this.hasAttribute('data-show-count')
|
|
23
|
+
? +this.getAttribute('data-show-count')
|
|
24
|
+
: 10;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
async onServerRender() {
|
|
@@ -28,6 +31,20 @@ class MasonryGallery extends GHComponent {
|
|
|
28
31
|
this.ghId = this.getAttribute('data-gh-id') || null;
|
|
29
32
|
this.json = await super.getGhData(this.ghId, this.application);
|
|
30
33
|
|
|
34
|
+
if (
|
|
35
|
+
typeof this.json.items === 'object' &&
|
|
36
|
+
this.json.items !== null &&
|
|
37
|
+
this.json.items.url
|
|
38
|
+
) {
|
|
39
|
+
const response = await fetch(this.json.items.url);
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
|
|
42
|
+
this.setCacheGhData(
|
|
43
|
+
'masonry-images',
|
|
44
|
+
data.images
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
31
48
|
if (Array.isArray(this.json.items)) {
|
|
32
49
|
const isMoreItems = this.json.moreItems ? this.json.moreItems : null;
|
|
33
50
|
|
|
@@ -55,32 +72,25 @@ class MasonryGallery extends GHComponent {
|
|
|
55
72
|
const modal = document.getElementById('modal');
|
|
56
73
|
|
|
57
74
|
if (this.hasAttribute('images-url')) {
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
const images = await this.getCacheGhData(
|
|
76
|
+
'masonry-images'
|
|
77
|
+
);
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
const isInitImagesEqualNull =
|
|
80
|
+
this.getAttribute('init-count') === 'null';
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
const initCountImages = this.contactUsButton
|
|
83
|
+
? this.showCount
|
|
84
|
+
: images.length;
|
|
65
85
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const initCountImages = this.hasAttribute('init-count') && !isInitImagesEqualNull ? this.getAttribute('init-count') : images.length;
|
|
86
|
+
const initImages = images.slice(0, initCountImages);
|
|
87
|
+
const initMoreImages = images.slice(initCountImages);
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
this.allImagesArrayLength = images.length;
|
|
90
|
+
this.initCountImages = initCountImages;
|
|
72
91
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.initImages = initImages;
|
|
77
|
-
this.moreImages = initMoreImages;
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error(error);
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
this.initImages = JSON.parse(this.getAttribute('init-images'));
|
|
83
|
-
this.moreImages = JSON.parse(this.getAttribute('add-array'));
|
|
92
|
+
this.initImages = initImages;
|
|
93
|
+
this.moreImages = initMoreImages;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
const grid = this.imagesContainer;
|
|
@@ -200,9 +210,35 @@ class MasonryGallery extends GHComponent {
|
|
|
200
210
|
const promise = new Promise(async (res, rej) => {
|
|
201
211
|
const img = document.createElement('img');
|
|
202
212
|
|
|
203
|
-
const
|
|
213
|
+
const fileName = imageSrc.split('/').pop();
|
|
214
|
+
|
|
215
|
+
const pathToJpg = `/assets/images/masonry/${fileName}`;
|
|
216
|
+
const pathToWebp = `${pathToJpg}.webp`;
|
|
217
|
+
|
|
218
|
+
const response = await fetch(pathToWebp, {
|
|
219
|
+
method: 'HEAD'
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
await fetch('/upload-image-path', {
|
|
224
|
+
method: 'POST',
|
|
225
|
+
headers: {
|
|
226
|
+
'Content-Type': 'application/json'
|
|
227
|
+
},
|
|
228
|
+
body: JSON.stringify({
|
|
229
|
+
imageSrc: pathToJpg,
|
|
230
|
+
imageUrl: imageSrc,
|
|
231
|
+
isCrop: true
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
img.src = `/assets/images/masonry/${fileName}`;
|
|
204
237
|
|
|
205
|
-
img.setAttribute(
|
|
238
|
+
img.setAttribute(
|
|
239
|
+
'src',
|
|
240
|
+
`/assets/images/masonry/${fileName}`
|
|
241
|
+
);
|
|
206
242
|
img.setAttribute('alt', imageAlt);
|
|
207
243
|
img.setAttribute('title', imageTitle);
|
|
208
244
|
|
|
@@ -252,6 +288,14 @@ class MasonryGallery extends GHComponent {
|
|
|
252
288
|
const button = buttonWrapper.querySelector('#grid-add-items');
|
|
253
289
|
const addImages = this.addImages;
|
|
254
290
|
|
|
291
|
+
if (!this.contactUsButton) {
|
|
292
|
+
if (button) {
|
|
293
|
+
button.remove();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
255
299
|
const isInitCountEqualAllLength = this.initCountImages === this.allImagesArrayLength;
|
|
256
300
|
|
|
257
301
|
if (!masonryGrid || !button || !buttonWrapper || !this.moreImages || isInitCountEqualAllLength) {
|
|
@@ -263,7 +307,7 @@ class MasonryGallery extends GHComponent {
|
|
|
263
307
|
let images = [...this.moreImages];
|
|
264
308
|
|
|
265
309
|
// Get more-count attribute value
|
|
266
|
-
const moreCountImages =
|
|
310
|
+
const moreCountImages = this.showCount;
|
|
267
311
|
|
|
268
312
|
button.addEventListener('click', async () => {
|
|
269
313
|
// If we set max-height for block, this code removes styles which hide content, when we click show more
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { drawImageCover } from '../utils/draw-image-cover.js';
|
|
2
|
+
|
|
3
|
+
export default function cascadeStrips({
|
|
4
|
+
ctx,
|
|
5
|
+
canvas,
|
|
6
|
+
images,
|
|
7
|
+
progress,
|
|
8
|
+
}) {
|
|
9
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
10
|
+
|
|
11
|
+
// BASE IMAGE
|
|
12
|
+
drawImageCover({
|
|
13
|
+
ctx,
|
|
14
|
+
canvas,
|
|
15
|
+
image: images[0],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const slidesCount =
|
|
19
|
+
images.length;
|
|
20
|
+
|
|
21
|
+
const sectorWidth =
|
|
22
|
+
canvas.width / slidesCount;
|
|
23
|
+
|
|
24
|
+
// GLOBAL WIPE POSITION
|
|
25
|
+
const totalTravel =
|
|
26
|
+
canvas.width
|
|
27
|
+
+ (
|
|
28
|
+
sectorWidth
|
|
29
|
+
* (slidesCount - 1)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const wipeX =
|
|
33
|
+
totalTravel * progress;
|
|
34
|
+
|
|
35
|
+
for (let i = 1; i < slidesCount; i++) {
|
|
36
|
+
|
|
37
|
+
const image =
|
|
38
|
+
images[i];
|
|
39
|
+
|
|
40
|
+
// OFFSET BETWEEN WIPES
|
|
41
|
+
const offset =
|
|
42
|
+
sectorWidth * (i - 1);
|
|
43
|
+
|
|
44
|
+
// CURRENT WIPE POSITION
|
|
45
|
+
const currentX =
|
|
46
|
+
wipeX - offset;
|
|
47
|
+
|
|
48
|
+
// NOT YET VISIBLE
|
|
49
|
+
if (currentX <= 0) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ctx.save();
|
|
54
|
+
|
|
55
|
+
ctx.beginPath();
|
|
56
|
+
|
|
57
|
+
// LAST SLIDE
|
|
58
|
+
if (i === slidesCount - 1) {
|
|
59
|
+
|
|
60
|
+
// CONTINUES TO FULLSCREEN
|
|
61
|
+
ctx.rect(
|
|
62
|
+
0,
|
|
63
|
+
0,
|
|
64
|
+
currentX,
|
|
65
|
+
canvas.height
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
} else {
|
|
69
|
+
|
|
70
|
+
// NORMAL STRIP
|
|
71
|
+
ctx.rect(
|
|
72
|
+
currentX - sectorWidth,
|
|
73
|
+
0,
|
|
74
|
+
sectorWidth,
|
|
75
|
+
canvas.height
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ctx.clip();
|
|
80
|
+
|
|
81
|
+
drawImageCover({
|
|
82
|
+
ctx,
|
|
83
|
+
canvas,
|
|
84
|
+
image,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
ctx.restore();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { drawImageCover } from '../utils/draw-image-cover.js';
|
|
2
|
+
|
|
3
|
+
export default function fade({
|
|
4
|
+
ctx,
|
|
5
|
+
canvas,
|
|
6
|
+
currentImage,
|
|
7
|
+
nextImage,
|
|
8
|
+
progress,
|
|
9
|
+
}) {
|
|
10
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
11
|
+
|
|
12
|
+
// CURRENT IMAGE
|
|
13
|
+
drawImageCover({
|
|
14
|
+
ctx,
|
|
15
|
+
canvas,
|
|
16
|
+
image: currentImage,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// NEXT IMAGE
|
|
20
|
+
ctx.save();
|
|
21
|
+
|
|
22
|
+
ctx.globalAlpha = progress;
|
|
23
|
+
|
|
24
|
+
drawImageCover({
|
|
25
|
+
ctx,
|
|
26
|
+
canvas,
|
|
27
|
+
image: nextImage,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
ctx.restore();
|
|
31
|
+
}
|