css摇曳的_使用CSS3构造的海上坐船摇晃动画效果

CSS

语言:

CSSSCSS

确定

body {

background-color: #09f;

color: #003;

font-family: 'Rye', serif;

font-size: calc(9px + 1vw);

overflow: hidden;

position: relative;

}

body:before {

animation: rock15 5s ease-in-out alternate infinite;

background-image: linear-gradient(#09f, #fff 50%, #06c 50%, #09f);

content: "";

height: 200%;

left: -50%;

position: absolute;

top: -50%;

transform-origin: center;

width: 200%;

z-index: -1;

}

article {

/* animation:slide 10s ease-in-out infinite; */

background-color: #fff;

border-radius: .25em;

box-sizing: border-box;

height: 50vh;

margin: 25vh 25vw;

opacity: .95;

padding: 1em;

width: 50vw;

}

header {

animation: rock3 5s ease-in-out alternate infinite;

border-bottom: solid 1px currentColor;

text-align: center;

}

h2 {

animation: slide 10s ease-in-out infinite;

background-color: #a60;

/* box-shadow:0.25em .25em .25em rgba(0,0,0,.5); */

color: #fff;

display: inline-block;

margin: 0;

padding: .25em .5em;

}

.seasick {

color: #990;

font-family: 'Chewy', cursive;

font-size: 1.1em;

}

@keyframes rock15 {

0% {

transform: rotate(15deg);

}

100% {

transform: rotate(-15deg);

}

}

@keyframes rock3 {

0% {

transform: rotate(3deg);

}

100% {

transform: rotate(-3deg);

}

}

@keyframes slide {

0% {

box-shadow: 0.25em .25em .25em rgba(0, 0, 0, .25);

transform: translateX(10vw);

}

25% {

transform: translateX(10vw);

}

50% {

box-shadow: -0.25em .25em .25em rgba(0, 0, 0, .25);

transform: translateX(-10vw);

}

75% {

transform: translateX(-10vw);

}

100% {

box-shadow: 0.25em .25em .25em rgba(0, 0, 0, .25);

transform: translateX(10vw);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值