feat: 首页动画调整
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
<!-- ChatTopWelcome不在可视区:显示并添加动画;在可视区:隐藏 -->
|
||||
<view
|
||||
v-show="show"
|
||||
:class="['ip w-32 h-32', { 'image-animated': show }]"
|
||||
:class="['w-32 h-32', { 'image-animated': show }]"
|
||||
:style="getStyle"
|
||||
></view>
|
||||
<text
|
||||
v-show="show"
|
||||
@@ -23,6 +24,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, computed, defineExpose } from "vue";
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
|
||||
const props = defineProps({
|
||||
mainPageDataModel: {
|
||||
@@ -33,9 +35,19 @@ const props = defineProps({
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
const logoImageUrl = computed(
|
||||
() => props.mainPageDataModel.initPageImages?.logoImageUrl
|
||||
);
|
||||
const getStyle = computed(() => {
|
||||
const config = getCurrentConfig();
|
||||
|
||||
return {
|
||||
"--ipSmallImageStep": config.ipSmallImageStep,
|
||||
"--ipSmallImageHeight": config.ipSmallImageHeight,
|
||||
"--ipSmallTime": config.ipSmallTime,
|
||||
backgroundImage: `url(${config.ipSmallImage})`,
|
||||
backgroundRepeat: "no-repeat",
|
||||
backgroundSize: "32px auto",
|
||||
backgroundPosition: "0 0",
|
||||
};
|
||||
});
|
||||
|
||||
const showDrawer = () => uni.$emit("SHOW_DRAWER");
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
.ip {
|
||||
background-image: url("https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 32px auto;
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
// 图片从0%到100%动画
|
||||
.image-animated {
|
||||
animation: logo-scale 0.3s ease-in-out, sprite-play 2s steps(117) infinite;
|
||||
animation: logo-scale 0.3s ease-in-out,
|
||||
sprite-play calc(var(--ipSmallTime) * 1s) steps(var(--ipSmallImageStep))
|
||||
infinite;
|
||||
}
|
||||
|
||||
@keyframes logo-scale {
|
||||
@@ -26,7 +21,7 @@
|
||||
|
||||
100% {
|
||||
/* 117 帧 × 每帧高度约 32px,终点应为 -(117-1)*32 = -5421px */
|
||||
background-position: 0 -3802px;
|
||||
background-position: 0 calc(var(--ipSmallImageHeight) * -1px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ v
|
||||
<view
|
||||
class="flex flex-items-center flex-justify-between border-box pl-12 pr-12"
|
||||
>
|
||||
<view class="ip"></view>
|
||||
<view class="ip" :style="getStyle"></view>
|
||||
<view
|
||||
class="welcome-text font-size-14 font-500 font-family-misans-vf color-171717 line-height-24"
|
||||
>
|
||||
@@ -20,6 +20,7 @@ v
|
||||
|
||||
<script setup>
|
||||
import { defineProps, computed, getCurrentInstance, defineExpose } from "vue";
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
import ChatMoreTips from "../ChatMoreTips/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -48,7 +49,19 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const initPageImages = computed(() => props.mainPageDataModel.initPageImages);
|
||||
const getStyle = computed(() => {
|
||||
const config = getCurrentConfig();
|
||||
|
||||
return {
|
||||
"--ipLargeImageStep": config.ipLargeImageStep,
|
||||
"--ipLargeImageHeight": config.ipLargeImageHeight,
|
||||
"--ipLargeTime": config.ipLargeTime,
|
||||
backgroundImage: `url(${config.ipLargeImage})`,
|
||||
backgroundRepeat: "no-repeat",
|
||||
backgroundSize: "158px auto",
|
||||
backgroundPosition: "0 0",
|
||||
};
|
||||
});
|
||||
const welcomeContent = computed(() => props.mainPageDataModel.welcomeContent);
|
||||
const guideWords = computed(() => props.mainPageDataModel.guideWords);
|
||||
|
||||
|
||||
@@ -6,11 +6,8 @@
|
||||
flex: 0 0 158px;
|
||||
width: 158px;
|
||||
height: 134px;
|
||||
background-image: url("https://oss.nianxx.cn/mp/static/version_101/dh/dh.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 158px auto;
|
||||
background-position: 0 0;
|
||||
animation: sprite-play 2s steps(40) infinite;
|
||||
animation: sprite-play calc(var(--ipLargeTime) * 1s)
|
||||
steps(var(--ipLargeImageStep)) infinite;
|
||||
}
|
||||
|
||||
@keyframes sprite-play {
|
||||
@@ -20,6 +17,6 @@
|
||||
|
||||
100% {
|
||||
/* 40 帧 × 每帧高度约 139px,终点应为 -(40-1)*139 = -5421px */
|
||||
background-position: 0 -5424px;
|
||||
background-position: 0 calc(var(--ipLargeImageHeight) * -1px);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user