<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="https://cdn.suoluomei.com/common/js2.0/vue/v2.5.16/vue.js"></script>
<script src="https://cdn.suoluomei.com/common/js/jquery-2.1.4.min.js"></script>
<title>女神节快乐</title>
<style>
[v-cloak] {
display: none !important;
}
* {
margin: 0;
padding: 0;
}
body {
background: #FFC6CD;
}
#Vue {
width: 100%;
}
.sreem {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
justify-content: center;
}
.wenzi {
width: 100%;
position: fixed;
top: 100%;
font-size: 2.5rem;
animation: nsmymove_a 5s ease-in-out 0s 1 alternate forwards;
text-align: center;
}
.nvshen {
color: white;
font-weight: bold;
}
.wenzitwo {
width: 100%;
position: fixed;
top: 48%;
display: flex;
flex-direction: column;
align-items: center;
/* animation: wzmymove_a 3s ease-in-out 5s 1 alternate forwards; */
}
.wenzitwoa {
font-size: 2.5rem;
color: white;
font-weight: bold;
opacity: 0;
animation: wzmymove_a 3s ease-in-out 5s 1 alternate forwards;
}
.wenzitwob {
font-size: 2.5rem;
color: white;
font-weight: bold;
opacity: 0;
animation: wzmymove_a 3s ease-in-out 7s 1 alternate forwards;
}
.wenzitwoc {
font-size: 2.5rem;
color: white;
font-weight: bold;
opacity: 0;
animation: wzmymove_a 3s ease-in-out 9s 1 alternate forwards;
}
.wenzitwod {
font-size: 2.5rem;
color: white;
font-weight: bold;
opacity: 0;
animation: wzmymove_a 3s ease-in-out 11s 1 alternate forwards;
}
.tupian {
width: 100%;
}
/* 动画 */
/* 从top:100%过渡到top:40%,从透明到出现*/
@keyframes nsmymove_a {
from {
top: 100%;
opacity: 0;
}
to {
top: 40%;
opacity: 1;
}
}
@keyframes nsmymove_b {
from {
top: 40%;
font-size: 2.5rem;
opacity: 1;
}
to {
top: 40%;
font-size: 0rem;
opacity: 0;
}
}
@keyframes wzmymove_a {
from {
/* top: 100%; */
opacity: 0;
font-size: 0rem;
}
to {
/* top: 48%; */
opacity: 1;
font-size: 2.5rem;
}
}
@keyframes wzmymove_b {
from {
top: 48%;
opacity: 1;
}
to {
top: 32%;
opacity: 1;
}
}
@keyframes wzmymove_c {
from {
top: 32%;
opacity: 1;
}
to {
top: -32%;
opacity: 1;
}
}
@keyframes tpmove {
from {
width: 0%;
top: 50%;
opacity: 0;
transform: rotate(0deg);
}
to {
width: 100%;
top: 0%;
opacity: 1;
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div v-cloak id="Vue">
<div class="sreem">
<div class="wenzi">
<span class="nvshen">女神节快乐</span>
</div>
<div class="wenzitwo">
<span class="wenzitwoa">2020</span>
<span class="wenzitwob">你的美貌</span>
<span class="wenzitwoc">继续营业</span>
<span class="wenzitwod">祝愿你</span>
</div>
<img class="tupian" :src="bjimg" alt="">
</div>
</div>
</body>
<script>
new Vue({
el: "#Vue",
data: {
bjimg: "",
bjsz: ["https://sucai.suoluomei.cn/sucai_zs/images/20200305164843-nsjtp1.jpg",
"https://sucai.suoluomei.cn/sucai_zs/images/20200305164903-nsjtp2.jpg",
"https://sucai.suoluomei.cn/sucai_zs/images/20200305164924-nsjtp3.jpg"]
},
methods: {
wenzianm() {
let that = this
setTimeout(function () {
console.log(1)
$(".wenzi").css("animation", "nsmymove_b 3s ease-in-out 0s 1 alternate forwards")
}, 7000);//七秒之后执行此操作,将新的动画写入div中。
setTimeout(function () {
console.log(2)
$(".wenzitwo").css("animation", "wzmymove_b 3s ease-in-out 0s 1 alternate forwards")
}, 9000);
setTimeout(function () {
console.log(2)
$(".wenzitwo").css("animation", "wzmymove_c 3s ease-in-out 0s 1 alternate forwards")
}, 14000);
setTimeout(function () {
console.log(3)
// that.bjimg = that.bjsz[Math.floor(Math.random() * that.bjsz.length)];
that.bjimg = "{$imgage}"
// that.bjimg = "https://sucai.suoluomei.cn/sucai_zs/images/20200305162345-nsjtk1.png"
$(".tupian").css("animation", "tpmove 2s ease-in-out 0s 1 alternate forwards")
}, 16000);
},
// wenzitwoanm() {
// }
},
created() {
let that = this
that.wenzianm();
// $.ajax({
// type: "get", //请求方式
// async: false,
// url: "",
// data: {}, //传值给后台
// dataType: "json",
// success: function (res) {
// console.log(res)
//
// },
// });
// axios.get('你的接口', {
// params: {
// 传给后台的值
// }
// })
// .then(function (res) {
// //成功的回调
// console.log(res)
// })
// .catch(function (error) {
// //失败的回调
// });
}
})
</script>
</html>
H5页面利用css3动画以及定时器制作动画效果
最新推荐文章于 2022-05-06 16:06:25 发布