-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSplitting.razor.js
More file actions
67 lines (57 loc) · 1.55 KB
/
Splitting.razor.js
File metadata and controls
67 lines (57 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { addLink, addScript } from '../../../BootstrapBlazor/modules/utility.js?v=$version'
const reset = el => {
const flip = el.querySelector(".splitting-flip");
if (flip) {
delete flip['🍌'];
flip.innerHTML = ''
}
}
const loader = el => {
const flip = el.querySelector(".splitting-flip");
const columns = el.getAttribute('data-bb-columns');
const repeat = el.getAttribute('data-bb-repeat');
const splitting = Splitting({
target: flip,
by: 'cells',
image: true,
columns: columns,
rows: 1
});
const cells = splitting[0].cells;
const tl = gsap.timeline({
repeat: repeat,
repeatDelay: 0.75
});
tl.from(cells, {
scale: 0,
transformOrigin: "center",
x: "1.5rem",
duration: 0.25,
ease: "circ.out",
stagger: {
amount: 3,
from: "start"
}
});
tl.to(cells, {
scale: 0,
xPercent: -900,
duration: 0.25,
stagger: {
amount: 0.75,
from: "start"
},
}, "+=0.5");
}
export async function init(id) {
await addLink('./_content/BootstrapBlazor.Splitting/splitting.bundle.css')
await addScript('./_content/BootstrapBlazor.Splitting/lib/splitting/splitting.min.js')
await addScript('./_content/BootstrapBlazor.Splitting/modules/gsap.min.js')
const el = document.getElementById(id);
loader(el);
}
export function update(id) {
const el = document.getElementById(id);
reset(el);
loader(el);
}