Skip to content

Commit 01799f0

Browse files
committed
perf(waterfall): fix waterfall repainting
1 parent dfab3fd commit 01799f0

5 files changed

Lines changed: 31 additions & 62 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
steps:
1111
- uses: actions/checkout@v3
1212
- name: Install pnpm
13-
uses: pnpm/action-setup@v2.2.1
13+
uses: pnpm/action-setup@v4
1414
with:
1515
version: "8.x"
1616
- name: Use Node.js

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v3
2121

2222
- name: Install pnpm
23-
uses: pnpm/action-setup@v2.2.1
23+
uses: pnpm/action-setup@v4
2424
with:
2525
version: "8.x"
2626

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v3
1212

1313
- name: Install pnpm
14-
uses: pnpm/action-setup@v2.2.1
14+
uses: pnpm/action-setup@v4
1515
with:
1616
version: "8.x"
1717

components/waterfall-pattern/waterfall-pattern.vue

Lines changed: 28 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ withDefaults(defineProps<WaterfallProperties>(), {
1717
</script>
1818

1919
<style lang="scss" scoped>
20+
$waterfall-width: 200px;
21+
2022
.waterfall {
2123
overflow: hidden;
2224
position: relative;
23-
width: 300px;
25+
width: $waterfall-width;
2426
height: 100%;
2527
2628
&.heartbeat {
@@ -59,19 +61,23 @@ withDefaults(defineProps<WaterfallProperties>(), {
5961
6062
&.lava {
6163
background: linear-gradient(180deg, #5968F4, #5d80fc, #5968F4);
64+
//display: flex;
65+
//flex-direction: column;
66+
//align-items: center;
6267
background-size: 100% 100vh;
63-
animation: 3s linear rectangle infinite;
6468
&::after {
6569
position: absolute;
66-
content: "";
6770
top: 0;
68-
left: 10%;
69-
right: 0;
70-
bottom: 75%;
71+
left: 0;
72+
width: 200px;
73+
height: 200px;
74+
content: "";
7175
background: linear-gradient(180deg, rgba(255, 101, 101, 0.00) 0%, #69adfa 100%);
72-
border-radius: 100% 0 0 100%;
76+
//border-radius: 100% 0 0 100%;
77+
border-radius: 100%;
7378
background-blend-mode: color-burn;
74-
animation: 40s linear rectangle-item infinite alternate;
79+
animation: 30s linear rectangle-item infinite alternate;
80+
will-change: transform, border-radius;
7581
}
7682
}
7783
@@ -114,70 +120,41 @@ withDefaults(defineProps<WaterfallProperties>(), {
114120
115121
@keyframes waterfall {
116122
from {
117-
top: -50%;
118-
bottom: 100%;
123+
transform: translateY(0%)
119124
}
120125
to {
121-
top: 100%;
122-
bottom: -50%;
126+
transform: translateY(calc(100vh + 300px))
123127
}
124128
}
125129
126130
@keyframes circle {
127131
from {
128-
right: 0;
132+
transform: translateX(0)
129133
}
130134
to {
131-
right: 100%;
132-
}
133-
}
134-
135-
@keyframes rectangle {
136-
from {
137-
background-position-y:0;
138-
}
139-
to {
140-
background-position-y: 100vh;
135+
transform: translateX(-$waterfall-width)
141136
}
142137
}
143138
144139
@keyframes rectangle-item {
145140
from {
146-
border-radius: 100% 0 0 100%;
147-
left: 10%;
148-
right: 0;
149-
150-
top: -25%;
151-
bottom: 100%;
141+
scale: 1;
152142
}
153143
33% {
154-
top: 100%;
155-
bottom: -25%;
156-
157-
border-radius: 0 100% 100% 0;
158-
left: 0;
159-
right: 10%;
144+
transform: skew(2deg);
160145
}
161-
34% {
162-
left: 10%;
163-
right: 0;
164-
border-radius: 100% 0 0 100%;
146+
50% {
147+
rotate: 180deg;
148+
transform: skewX(3deg) skewY(5deg);
149+
scale: 0.88;
165150
}
166151
66% {
167-
top: -25%;
168-
bottom: 100%;
169-
170-
border-radius: 0 100% 100% 0;
171-
left: 0;
172-
right: 10%;
152+
transform: skew(17deg);
173153
}
174154
to {
175-
top: 100%;
176-
bottom: -25%;
177-
178-
border-radius: 100% 0 0 100%;
179-
left: 10%;
180-
right: 0;
155+
translate: 0 calc(100vh - 300px);
156+
transform: skew(8deg);
157+
scale: 1;
181158
}
182159
}
183160

pages/index.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ const { data: posts } = await usePosts({ limit: 5, tagLimit: 2 });
127127
.waterfall {
128128
display: none;
129129
align-items: center;
130-
131-
&__item {
132-
width: 200px;
133-
}
134130
}
135131
136132
@include from-md {
@@ -149,9 +145,5 @@ const { data: posts } = await usePosts({ limit: 5, tagLimit: 2 });
149145
.content__title {
150146
font-size: 72px !important;
151147
}
152-
153-
.waterfall__item {
154-
width: 250px;
155-
}
156148
}
157149
</style>

0 commit comments

Comments
 (0)