nodality 1.0.0-beta.2 → 1.0.0-beta.21
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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/animator.cjs.js +1 -1
- package/dist/animator.esm.js +1 -1
- package/dist/appleanim.cjs.js +1 -0
- package/dist/appleanim.esm.js +1 -0
- package/dist/audionew.cjs.js +1 -1
- package/dist/audionew.esm.js +1 -1
- package/dist/base.cjs.js +1 -1
- package/dist/base.esm.js +1 -1
- package/dist/betaDesktopBar.esm.js +1 -1
- package/dist/betaMobileBar.esm.js +1 -1
- package/dist/bundle.umd.js +1 -1
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/cardGetter.cjs.js +1 -1
- package/dist/cardGetter.esm.js +1 -1
- package/dist/center.cjs.js +1 -1
- package/dist/center.esm.js +1 -1
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +1 -1
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/datalist.cjs.js +1 -1
- package/dist/datalist.esm.js +1 -1
- package/dist/designer.cjs.js +1 -1
- package/dist/designer.esm.js +1 -1
- package/dist/dropdown.cjs.js +1 -1
- package/dist/dropdown.esm.js +1 -1
- package/dist/elementMapper.cjs.js +1 -1
- package/dist/elementMapper.esm.js +1 -1
- package/dist/finalresult.esm.js +1 -1
- package/dist/flexCard.cjs.js +1 -1
- package/dist/flexCard.esm.js +1 -1
- package/dist/flexGrid.cjs.js +1 -1
- package/dist/flexGrid.esm.js +1 -1
- package/dist/flexRow.cjs.js +1 -1
- package/dist/flexRow.esm.js +1 -1
- package/dist/floatingInput.cjs.js +1 -1
- package/dist/floatingInput.esm.js +1 -1
- package/dist/free.cjs.js +1 -1
- package/dist/free.esm.js +1 -1
- package/dist/horizontalScroller.esm.js +1 -1
- package/dist/image.cjs.js +1 -1
- package/dist/image.esm.js +1 -1
- package/dist/imagePicker.cjs.js +1 -1
- package/dist/imagePicker.esm.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/link.cjs.js +1 -1
- package/dist/link.esm.js +1 -1
- package/dist/linkGetter.cjs.js +1 -1
- package/dist/linkGetter.esm.js +1 -1
- package/dist/metaAdder.cjs.js +1 -1
- package/dist/metaAdder.esm.js +1 -1
- package/dist/modal2025.cjs.js +1 -1
- package/dist/modal2025.esm.js +1 -1
- package/dist/multiswitchers.esm.js +1 -1
- package/dist/newNavBar.cjs.js +1 -1
- package/dist/newNavBar.esm.js +1 -1
- package/dist/picker.cjs.js +1 -1
- package/dist/picker.esm.js +1 -1
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +1 -1
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +1 -1
- package/dist/range.cjs.js +1 -1
- package/dist/range.esm.js +1 -1
- package/dist/scrollvideo.cjs.js +1 -0
- package/dist/scrollvideo.esm.js +1 -0
- package/dist/sideBar.cjs.js +1 -1
- package/dist/sideBar.esm.js +1 -1
- package/dist/sideNavBar.cjs.js +1 -1
- package/dist/sideNavBar.esm.js +1 -1
- package/dist/simpleBar.cjs.js +1 -1
- package/dist/simpleBar.esm.js +1 -1
- package/dist/stack.cjs.js +1 -1
- package/dist/stack.esm.js +1 -1
- package/dist/stacker.cjs.js +1 -0
- package/dist/stacker.esm.js +1 -0
- package/dist/table.cjs.js +1 -1
- package/dist/table.esm.js +1 -1
- package/dist/text.cjs.js +1 -1
- package/dist/text.esm.js +1 -1
- package/dist/textField.cjs.js +1 -1
- package/dist/textField.esm.js +1 -1
- package/dist/transformanim.cjs.js +1 -0
- package/dist/transformanim.esm.js +1 -0
- package/dist/wrap.cjs.js +1 -1
- package/dist/wrap.esm.js +1 -1
- package/dist/zoomCard.cjs.js +1 -1
- package/dist/zoomCard.esm.js +1 -1
- package/layout/index.js +16 -0
- package/layout/sideNavBar.js +1 -1
- package/layout/text.js +2 -0
- package/lib/AppleAnim.js +789 -0
- package/lib/Stacker.js +36 -0
- package/lib/TransformAnim.js +514 -0
- package/lib/designer.js +250 -6
- package/lib/elementMapper.js +7 -29
- package/lib/scrollvideo.js +125 -0
- package/package.json +18 -4
package/lib/Stacker.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class Stacker {
|
|
4
|
+
constructor(){
|
|
5
|
+
this.res = document.createElement("div");
|
|
6
|
+
this.res.style.display = "flex";
|
|
7
|
+
this.res.style.flexDirection = "column";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
add(items){
|
|
11
|
+
for (var i = 0; i < items.length; i++){
|
|
12
|
+
let item = items[i].render();
|
|
13
|
+
|
|
14
|
+
if (i === 0){ // if KeyframeAnima and then transformAnim apply this condition
|
|
15
|
+
// Keep this in stacker for now
|
|
16
|
+
item.style.zIndex = 1; // important
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.res.appendChild(item);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render(div){
|
|
26
|
+
if (div){
|
|
27
|
+
document.querySelector(div).appendChild(this.res);
|
|
28
|
+
} else {
|
|
29
|
+
return this.res;
|
|
30
|
+
}
|
|
31
|
+
// document.body.appendChild(this.res);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export {Stacker};
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function convertRange(value, oldRange, newRange) {
|
|
5
|
+
let val = ((value - oldRange.min) * (newRange.max - newRange.min)) / (oldRange.max - oldRange.min) + newRange.min;
|
|
6
|
+
|
|
7
|
+
if (val > 1) {
|
|
8
|
+
val = 2 - val;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return val;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class TransformAnim { // 133506
|
|
15
|
+
constructor(data) {
|
|
16
|
+
this.data = data;
|
|
17
|
+
this.targetHeight = this.data.targetHeight;
|
|
18
|
+
if (this.data.type === undefined) {
|
|
19
|
+
this.type = "default";
|
|
20
|
+
} else {
|
|
21
|
+
this.type = this.data.type;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// this.id = this.data.identifiers.wrapDIV;
|
|
25
|
+
this.layout = "flex";
|
|
26
|
+
this.setup();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
toCode(){
|
|
30
|
+
return [""];
|
|
31
|
+
}
|
|
32
|
+
set(obj){
|
|
33
|
+
console.log("WHY NOT 900")
|
|
34
|
+
// alert(this.res.style.height);
|
|
35
|
+
obj.arrayPadding && (this.wrdiv.style.marginTop = obj.arrayPadding.value /*this.res.style.height*/);
|
|
36
|
+
obj.height && (this.wrdiv.style.height = obj.height);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setup() {
|
|
41
|
+
// this.fireDist = this.data.fireDist;
|
|
42
|
+
|
|
43
|
+
// I need two
|
|
44
|
+
let wrapDiv = document.createElement("div");
|
|
45
|
+
this.wrdiv = wrapDiv;
|
|
46
|
+
wrapDiv.style.display = "flex";
|
|
47
|
+
wrapDiv.style.flexDirection = "column";
|
|
48
|
+
|
|
49
|
+
if (this.data.overflow){
|
|
50
|
+
wrapDiv.style.overflow = "hidden";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// wrapDiv.setAttribute("id", this.data.identifiers.wrapDIV);
|
|
54
|
+
wrapDiv.style.display = "flex";
|
|
55
|
+
wrapDiv.style.justifyContent = "center";
|
|
56
|
+
wrapDiv.style.alignItems = "center";
|
|
57
|
+
wrapDiv.style.background = "orange";
|
|
58
|
+
// wrapDiv.style.height = "100vh"; // Keep this
|
|
59
|
+
wrapDiv.style.height = "900px"; // same as paddingTop
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if (!this.data.sticky) {
|
|
63
|
+
|
|
64
|
+
wrapDiv.style.position = "fixed";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
wrapDiv.style.marginTop = "0px";
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
let img = document.createElement("img");
|
|
73
|
+
img.style.gridArea = "1/1";
|
|
74
|
+
img.style.display = "none";
|
|
75
|
+
img.style.width = "50%";
|
|
76
|
+
img.setAttribute("src", "M2.jpeg");
|
|
77
|
+
img.setAttribute("class", "m2");
|
|
78
|
+
// img.setAttribute("id", this.data.identifiers.imageID);
|
|
79
|
+
// img.style.transform = `scale(1.5)`;
|
|
80
|
+
wrapDiv.appendChild(img);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if (this.data.view){
|
|
84
|
+
// wrapDiv.appendChild(this.data.view.render());
|
|
85
|
+
|
|
86
|
+
this.m2img = this.data.view.render();
|
|
87
|
+
wrapDiv.appendChild(this.m2img);
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (this.data.paragraph){
|
|
92
|
+
this.paragraph = this.data.paragraph.render();
|
|
93
|
+
wrapDiv.appendChild(this.paragraph);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this.data.view){
|
|
97
|
+
img.style.display = "none";
|
|
98
|
+
// img.style.opacity = 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
let h2 = document.createElement("h2");
|
|
102
|
+
// h2.setAttribute("id", this.data.identifiers.headerID);
|
|
103
|
+
// h2.setAttribute("id", "header");
|
|
104
|
+
h2.style.fontFamily = "Arial";
|
|
105
|
+
h2.style.fontSize = "2.4rem";
|
|
106
|
+
h2.style.background = "linear-gradient(#3498db, #1abc9c)";
|
|
107
|
+
h2.style.webkitBackgroundClip = "text";
|
|
108
|
+
h2.style.webkitTextFillColor = "transparent"; // 222318
|
|
109
|
+
|
|
110
|
+
let node = document.createTextNode("Supercharged");
|
|
111
|
+
h2.appendChild(node);
|
|
112
|
+
|
|
113
|
+
if (this.data.showTitle === true || this.data.showTitle === undefined){
|
|
114
|
+
|
|
115
|
+
if (this.data.content && this.data.content.render){
|
|
116
|
+
wrapDiv.appendChild(this.data.content.render());
|
|
117
|
+
} else {
|
|
118
|
+
wrapDiv.appendChild(h2);
|
|
119
|
+
}
|
|
120
|
+
// wrapDiv.appendChild(h2);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
let p = document.createElement("p");
|
|
125
|
+
let pn = document.createTextNode("Hello");
|
|
126
|
+
// p.appendChild(pn);
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
wrapDiv.appendChild(p);
|
|
131
|
+
|
|
132
|
+
this.res = wrapDiv;
|
|
133
|
+
|
|
134
|
+
window.addEventListener("scroll", (e) => this.resize(wrapDiv, img, h2));
|
|
135
|
+
this.resize(wrapDiv, img, h2);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setStickyData(obj){
|
|
139
|
+
this.data.stickyData = obj;
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
toAuto(){
|
|
145
|
+
// M3 Max won't fit no 100vh
|
|
146
|
+
this.res.style.height = "auto";
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
stick(obj){
|
|
152
|
+
if (!obj){
|
|
153
|
+
this.makeSticky();
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if (obj.offset){
|
|
159
|
+
if (this.data.stickyData != undefined){
|
|
160
|
+
// alert(topOffset);
|
|
161
|
+
this.data.stickyData.top = obj.offset;
|
|
162
|
+
|
|
163
|
+
} else {
|
|
164
|
+
this.data.stickyData = {top: obj.offset};
|
|
165
|
+
this.fixedToRelative(true); // inner method
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (obj.value){
|
|
171
|
+
this.makeSticky();
|
|
172
|
+
} else {
|
|
173
|
+
this.noSticky();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
makeSticky(){
|
|
180
|
+
this.wrdiv.style.position = "sticky";
|
|
181
|
+
this.wrdiv.style.top = 0;
|
|
182
|
+
|
|
183
|
+
// 22:23:18 Yes!!!
|
|
184
|
+
// 22:23:39 mobile
|
|
185
|
+
//this.wrdiv.style.marginTop = "800px";
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
setProps(obj){
|
|
191
|
+
|
|
192
|
+
if (obj.targetHeight){
|
|
193
|
+
this.data.targetHeight = obj.targetHeight;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
if (obj.flagValue){
|
|
198
|
+
this.data.flagValue = obj.flagValue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return this;
|
|
202
|
+
/* targetHeight: 600,
|
|
203
|
+
flagValue: 3700,*/
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
noSticky(){
|
|
208
|
+
// this.wrdiv.style.display = "none";
|
|
209
|
+
// this.wrdiv.style.filter = "grayscale(1)";
|
|
210
|
+
this.wrdiv.style.position = "";
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
toSticky(){
|
|
215
|
+
this.wrdiv.style.position = "sticky";
|
|
216
|
+
this.wrdiv.style.top = "0";
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
toOpacity(opacity){
|
|
221
|
+
this.res.style.opacity = `${opacity}`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
setUncomment(value){
|
|
225
|
+
this.data.uncomment = value;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fixedToRelative(value){
|
|
229
|
+
this.data.uncomment = value;
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
mask(data){
|
|
240
|
+
window.addEventListener("scroll", () => {
|
|
241
|
+
this.innerMask(data);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
innerMask(data){
|
|
248
|
+
if (data){
|
|
249
|
+
|
|
250
|
+
let smart = smartRange(window.scrollY, {min: data.start, max: data.end}, {min: 7, max: 0}) // The other way
|
|
251
|
+
console.warn(smart);
|
|
252
|
+
console.warn(window.scrollY);
|
|
253
|
+
// this.res.style.opacity = 0.7;
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// let smart = smartRange(window.scrollY, { min: data.start, max: data.end }, { min: 0, max: 7 }) // The other way
|
|
257
|
+
let radius = smartRange(window.scrollY, { min: data.start, max: data.end }, { min: 37, max: 37 }) // both are 20 to stay round
|
|
258
|
+
// this.res.style.clipPath = `inset(${smart}% ${smart}% round ${radius}px ${radius}px 0 0)`;
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
// this.res.style.clipPath = `inset(${smart}% ${smart}% round 20px)`;
|
|
264
|
+
// console.log(`SMART: ${smart}`);
|
|
265
|
+
// console.log(this.textOpacity);
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
// this.res.style.backgroundColor = "orange";
|
|
271
|
+
|
|
272
|
+
/* if (!this.hasH2){
|
|
273
|
+
let grayBack = document.createElement("div");
|
|
274
|
+
grayBack.style.background = "#ecf0f1";
|
|
275
|
+
grayBack.style.width = "86%";
|
|
276
|
+
grayBack.style.marginLeft = "7%";
|
|
277
|
+
grayBack.style.borderRadius = "1rem";
|
|
278
|
+
|
|
279
|
+
this.hasH2 = true;
|
|
280
|
+
grayBack.appendChild(this.data.newSection.render());
|
|
281
|
+
rem.parentElement.appendChild(grayBack);
|
|
282
|
+
}*/
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
return this;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
setScale(obj){
|
|
290
|
+
//alert("///")
|
|
291
|
+
/*
|
|
292
|
+
range: {
|
|
293
|
+
min: 0,
|
|
294
|
+
max: 750,
|
|
295
|
+
scaleMin: 0.67,
|
|
296
|
+
scaleMax: 2.4
|
|
297
|
+
},
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
// alert("J");
|
|
301
|
+
this.data.range = obj;
|
|
302
|
+
|
|
303
|
+
this.m2img.style.transform = `scale(${this.data.range.scaleMax})`;
|
|
304
|
+
|
|
305
|
+
window.addEventListener("scroll", () => {
|
|
306
|
+
let resa = smartRange(window.scrollY, {
|
|
307
|
+
min: this.data.range.min,
|
|
308
|
+
max: this.data.range.max // has to be switched
|
|
309
|
+
}, {
|
|
310
|
+
min: this.data.range.scaleMax,
|
|
311
|
+
max: this.data.range.scaleMin
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
if (this.m2img != undefined) {
|
|
315
|
+
this.m2img.style.transform = `scale(${resa})`;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
return this;
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
resize(wrapDiv, img, h2){
|
|
329
|
+
let st = window.scrollY || document.documentElement.scrollTop; // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
330
|
+
if (st > this.lastScrollTop) {
|
|
331
|
+
this.isUp = false;
|
|
332
|
+
} else {
|
|
333
|
+
this.isUp = true;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
// console.log(window.scrollY);
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
// let wrapDiv =document.querySelector(`#${this.data.identifiers.wrapDIV}`);
|
|
341
|
+
|
|
342
|
+
// let magicNumber = this.fireDist + 110;
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
if (!this.data.sticky){
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
if (this.data.stickyData){
|
|
349
|
+
// console.log(this.data.stickyData.top);
|
|
350
|
+
|
|
351
|
+
const top = this.data.stickyData.top; //800;
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
// UNCOMMENT HERE
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
if (this.data.uncomment) {
|
|
359
|
+
if (window.scrollY > top) { // MAKE THIS ADJUSTABLE
|
|
360
|
+
wrapDiv.style.background = "pink";
|
|
361
|
+
wrapDiv.style.position = "relative";
|
|
362
|
+
wrapDiv.style.top = top; // FIX HERE
|
|
363
|
+
} else {
|
|
364
|
+
wrapDiv.style.background = "orange";
|
|
365
|
+
wrapDiv.style.top = 0;
|
|
366
|
+
wrapDiv.style.position = "fixed";
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
} else {
|
|
377
|
+
wrapDiv.style.background = "#fafafa";
|
|
378
|
+
// wrapDiv.style.position = "relative"; UNCOMMENT ???
|
|
379
|
+
// wrapDiv.style.height = "100vh";
|
|
380
|
+
// wrapDiv.style.marginTop = "900px"; // 17:09:46 Nice!!!
|
|
381
|
+
// After Psyche launch
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// 15:19:50 Nice!!!
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
/* if (wrapDiv) {
|
|
389
|
+
if (window.scrollY > this.data.distanceObject.scrollUpper) {
|
|
390
|
+
if (wrapDiv) {
|
|
391
|
+
wrapDiv.style.background = "pink";
|
|
392
|
+
wrapDiv.style.position = "relative";
|
|
393
|
+
wrapDiv.style.top = `${this.data.distanceObject.scrollUpper}px`;
|
|
394
|
+
h2.textContent = "Always";
|
|
395
|
+
}
|
|
396
|
+
} else if (window.scrollY < this.data.distanceObject.scrollUpper && this.isUp) {
|
|
397
|
+
wrapDiv.style.background = "orange";
|
|
398
|
+
wrapDiv.style.top = "0px";
|
|
399
|
+
wrapDiv.style.position = "fixed";
|
|
400
|
+
}
|
|
401
|
+
} */
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
this.lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
|
|
407
|
+
|
|
408
|
+
let hTwo = wrapDiv;
|
|
409
|
+
/* let elHeight = this.data.targetHeight;
|
|
410
|
+
let begin = elHeight - 250;
|
|
411
|
+
let end = elHeight + 250;*/
|
|
412
|
+
|
|
413
|
+
/* let resa = smartRange(window.scrollY, {
|
|
414
|
+
min: this.data.range.min,
|
|
415
|
+
max: this.data.range.max // has to be switched
|
|
416
|
+
}, {
|
|
417
|
+
min: this.data.range.scaleMax,
|
|
418
|
+
max: this.data.range.scaleMin
|
|
419
|
+
});
|
|
420
|
+
*/
|
|
421
|
+
let m2img = img;
|
|
422
|
+
let header = h2;
|
|
423
|
+
|
|
424
|
+
this.m2img = img;
|
|
425
|
+
|
|
426
|
+
if (this.data.view){
|
|
427
|
+
m2img = this.m2img;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
if (m2img != undefined) {
|
|
432
|
+
// m2img.style.transform = `scale(${resa})`;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
let translated = smartRange(window.scrollY, {
|
|
437
|
+
min: 3150,
|
|
438
|
+
max: 3300 // has to be switched
|
|
439
|
+
}, {
|
|
440
|
+
min: 0,
|
|
441
|
+
max: 100
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
let translateScale = smartRange(window.scrollY, {
|
|
445
|
+
min: 3150,
|
|
446
|
+
max: 3300 // has to be switched
|
|
447
|
+
}, {
|
|
448
|
+
min: 60,
|
|
449
|
+
max: 80
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
let rotateScale = smartRange(window.scrollY, {
|
|
453
|
+
min: 3150,
|
|
454
|
+
max: 3300 // has to be switched
|
|
455
|
+
}, {
|
|
456
|
+
min: 0,
|
|
457
|
+
max: 40
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
// console.warn(translateScale);
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
if (this.data.operation){
|
|
466
|
+
if (this.data.operation.type === "translate"){
|
|
467
|
+
m2img.style.transform = `translate3d(${translated}%, ${translated / 2}%, 0px) scale(${translateScale / 100}) rotate(${rotateScale}deg)`;
|
|
468
|
+
// alert("I")
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
render(id) {
|
|
475
|
+
if (id) {
|
|
476
|
+
document.querySelector(id).appendChild(this.res);
|
|
477
|
+
} else {
|
|
478
|
+
return this.res;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
function smartRange(val, from, to) {
|
|
485
|
+
|
|
486
|
+
if (val < from.min) {
|
|
487
|
+
val = from.min;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (val > from.max) {
|
|
491
|
+
val = from.max;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
let percent = (val - from.min) / (from.max - from.min);
|
|
495
|
+
|
|
496
|
+
if (from.min > from.max) {
|
|
497
|
+
percent = (val - from.max) / (from.min - from.max);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
let toRange = (to.min - to.max) * percent - to.min;
|
|
501
|
+
toRange = Math.abs(toRange);
|
|
502
|
+
|
|
503
|
+
if (to.min < to.max) {
|
|
504
|
+
let sm = to.max + Math.abs(to.min);
|
|
505
|
+
let timesPerc = sm * percent;
|
|
506
|
+
toRange = to.min + timesPerc;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
return toRange;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
export {TransformAnim};
|