Skip to content

Commit

Permalink
feat: 在第一屏增加波浪动画 (#462)
Browse files Browse the repository at this point in the history
* feat: 在第一屏增加波浪动画

* feat: 默认隐藏波浪动画并使其适配视频模式
  • Loading branch information
LIlGG authored Dec 11, 2023
1 parent 7df996b commit d393e62
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 2 deletions.
12 changes: 12 additions & 0 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ spec:
label: 开启
- value: false
label: 关闭
- $formkit: radio
name: focus_wave
id: focus_wave
key: focus_wave
if: "$get(head_focus).value == true && $get(focus_height).value == true"
label: 波浪效果
value: false
options:
- value: true
label: 开启
- value: false
label: 关闭
- $formkit: attachment
if: "$get(head_focus).value == true"
name: focus_img_1
Expand Down
2 changes: 2 additions & 0 deletions src/css/common/components/screen/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

@import "video-box";

@import "wave.css";

@import "top-down.css";
33 changes: 33 additions & 0 deletions src/css/common/components/screen/wave.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.home-wave {
z-index: 1;
position: relative;
width: 400%;
transition: 0.4s ease all;

& > div {
position: absolute;
bottom: 0;
width: 100%;
}

& .wave-1 {
height: 65px;
left: -236px;
animation: wave 100s linear 0s infinite;
}

& .wave-2 {
height: 80px;
left: 0px;
animation: wave 240s linear 0s infinite;
}
}

@keyframes wave {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-50.5%);
}
}
6 changes: 6 additions & 0 deletions src/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default class Index {
videoContainerElement.insertAdjacentElement("afterbegin", document.createElement("video"));
const videoStatusElement = videoContainerElement.querySelector(".video-status") as HTMLDivElement;
const focusInfoElement = document.querySelector(".focusinfo") as HTMLDivElement;
const homeWaveElement = document.querySelector(".home-wave") as HTMLDivElement;
const videoPlayButtonElement = videoContainerElement.querySelector(".video-play") as HTMLDivElement;
const videoPauseButtonElement = videoContainerElement.querySelector(".video-pause") as HTMLDivElement;

Expand Down Expand Up @@ -99,6 +100,7 @@ export default class Index {

videoPlayer.on("loadeddata", () => {
videoStatusElement.style.bottom = "-100px";
homeWaveElement.style.bottom = "-100px";
focusInfoElement.style.top = "-999px";
videoPlayButtonElement.style.display = "none";
videoPauseButtonElement.style.display = "block";
Expand All @@ -107,6 +109,7 @@ export default class Index {

videoPlayer.on("play", () => {
videoStatusElement.style.bottom = "-100px";
homeWaveElement.style.bottom = "-100px";
focusInfoElement.style.top = "-999px";
videoPlayButtonElement.style.display = "none";
videoPauseButtonElement.style.display = "block";
Expand All @@ -115,6 +118,7 @@ export default class Index {
videoPlayer.on("pause", () => {
videoStatusElement.innerHTML = sakura.translate("home.video.statu_pause", "已暂停 ...");
videoStatusElement.style.bottom = "0";
homeWaveElement.style.bottom = "0";
focusInfoElement.style.top = "0";
videoPlayButtonElement.style.display = "block";
videoPauseButtonElement.style.display = "none";
Expand All @@ -133,6 +137,7 @@ export default class Index {
videoStatusElement.innerHTML = sakura.translate("home.video.statu_error", "视频播放错误");
setTimeout(() => {
focusInfoElement.style.top = "0";
homeWaveElement.style.bottom = "0";
videoStatusElement.style.bottom = "-100px";
videoPlayButtonElement.style.display = "block";
videoPauseButtonElement.style.display = "none";
Expand All @@ -144,6 +149,7 @@ export default class Index {

videoPlayer.on("ended", () => {
focusInfoElement.style.top = "0";
homeWaveElement.style.bottom = "0";
videoStatusElement.style.bottom = "-100px";
videoPlayButtonElement.style.display = "block";
videoPauseButtonElement.style.display = "none";
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/dist/css/main.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/assets/dist/page/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added templates/assets/images/wave/wave1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/assets/images/wave/wave2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions templates/module/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<th:block th:if="${theme.config.mainScreen.bgvideo}">
<th:block th:replace="~{module/home/video_box}"></th:block>
</th:block>
<th:block th:if="${theme.config.mainScreen.focus_wave}">
<th:block th:replace="~{module/home/wave}"></th:block>
</th:block>
<th:block th:if="${theme.config.mainScreen.focus_godown}">
<th:block th:replace="~{module/home/go_down}"></th:block>
</th:block>
Expand Down
8 changes: 8 additions & 0 deletions templates/module/home/wave.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<th:block
th:if="${theme.config.mainScreen.focus_height}"
>
<div class="home-wave">
<div class="wave-1" th:style="|background: url(${#theme.assets('/images/wave/wave1.png')}) repeat-x|"></div>
<div class="wave-2" th:style="|background: url(${#theme.assets('/images/wave/wave2.png')}) repeat-x|"></div>
</div>
</th:block>

0 comments on commit d393e62

Please sign in to comment.