231 lines
6.0 KiB
Vue
231 lines
6.0 KiB
Vue
|
|
|
|
<template>
|
|
<div class="animation-container">
|
|
<div class="moving-box" @mouseover="hovered = true" @mouseleave="hovered = false">
|
|
<!-- {{ hovered ? '暂停中' : '移动中' }} -->
|
|
|
|
<div class="hzhb-mind">
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-1.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-2.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-3.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-4.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-5.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-6.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-7.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-8.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-9.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-10.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-11.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-1.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-2.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-3.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-4.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-5.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-6.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-7.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-8.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-9.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-10.png" alt="" class="" />
|
|
</div>
|
|
<div class="hzhb-mind-box">
|
|
<img src="../../assets/hzhb/hzhb-11.png" alt="" class="" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
el: '#app',
|
|
components: {},
|
|
data() {
|
|
return {
|
|
hovered: false,
|
|
isPaused: false,
|
|
};
|
|
},
|
|
mounted() {},
|
|
beforeUnmount() {},
|
|
methods: {
|
|
toggleAnimation() {
|
|
this.isPaused = !this.isPaused;
|
|
const box = document.querySelector('.moving-box');
|
|
if (this.isPaused) {
|
|
box.style.animationPlayState = 'paused';
|
|
} else {
|
|
box.style.animationPlayState = 'running';
|
|
}
|
|
},
|
|
resetAnimation() {
|
|
const box = document.querySelector('.moving-box');
|
|
box.style.animation = 'none';
|
|
void box.offsetWidth; // 触发重绘
|
|
box.style.animation = null;
|
|
this.isPaused = false;
|
|
this.hovered = false;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.animation-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 200px;
|
|
margin-bottom: 30px;
|
|
overflow: hidden;
|
|
// background: rgba(0, 0, 0, 0.2);
|
|
// border: 2px solid rgba(255, 255, 255, 0.1);
|
|
border-radius: 12px;
|
|
}
|
|
.moving-box {
|
|
position: absolute;
|
|
top: 70px;
|
|
left: 0;
|
|
display: flex;
|
|
font-weight: bold;
|
|
color: white;
|
|
// background: linear-gradient(45deg, #ff8a00, #e52e71);
|
|
border-radius: 8px;
|
|
// box-shadow: 0 5px 15px rgba(229, 46, 113, 0.6);
|
|
|
|
/* 动画定义 */
|
|
animation: moveRight 60s linear infinite;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.moving-box:hover {
|
|
cursor: pointer;
|
|
// background: linear-gradient(45deg, #00c9ff, #92fe9d);
|
|
// box-shadow: 0 5px 15px rgba(0, 201, 255, 0.6);
|
|
animation-play-state: paused;
|
|
}
|
|
|
|
/* 修改动画关键帧 */
|
|
@keyframes moveRight {
|
|
0% {
|
|
// left: 2%; /* 从左侧外部开始 */
|
|
transform: translateX(-40px);
|
|
}
|
|
100% {
|
|
// left: -50%; /* 移动到右侧外部 */
|
|
transform: translateX(-4792px);
|
|
}
|
|
}
|
|
.controls {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 15px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.btn {
|
|
padding: 12px 24px;
|
|
font-weight: bold;
|
|
color: white;
|
|
cursor: pointer;
|
|
background: linear-gradient(45deg, #1a2a6c, #b21f1f);
|
|
border: none;
|
|
border-radius: 50px;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
transition: all 0.3s;
|
|
}
|
|
.btn:hover {
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
|
}
|
|
.btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
.info-panel {
|
|
padding: 20px;
|
|
color: white;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border-radius: 12px;
|
|
}
|
|
.info-panel h2 {
|
|
margin-bottom: 15px;
|
|
text-align: center;
|
|
}
|
|
.code-example {
|
|
padding: 15px;
|
|
margin-top: 15px;
|
|
overflow-x: auto;
|
|
font-family: monospace;
|
|
background: rgba(0, 0, 0, 0.2);
|
|
border-radius: 8px;
|
|
}
|
|
.instructions {
|
|
margin-top: 20px;
|
|
line-height: 1.6;
|
|
color: #ddd;
|
|
}
|
|
.instructions li {
|
|
margin-bottom: 8px;
|
|
}
|
|
.hzhb-mind {
|
|
display: flex;
|
|
padding: 0 10%;
|
|
// margin-top: 180px;
|
|
.hzhb-mind-box {
|
|
width: 392px;
|
|
margin-right: 40px;
|
|
// height: 280px;
|
|
}
|
|
.hzhb-mind-box-bottom {
|
|
width: 100%;
|
|
padding: 39px 0;
|
|
font-size: 28px;
|
|
font-weight: 500;
|
|
line-height: 42px;
|
|
letter-spacing: 0;
|
|
color: #1a1b24;
|
|
text-align: center;
|
|
background-image: linear-gradient(180deg, #f4fff9 0%, #cfeaff 100%);
|
|
border-radius: 8px;
|
|
transform: translateY(-10px);
|
|
}
|
|
}
|
|
</style>
|