css拉伸动画,12个动画基本模式 - CSS3 挤压和拉伸的动画

CSS

语言:

CSSSCSS

确定

body {

background-color: #2e2e2e;

font-family: "futura-pt", futura, sans-serif;

color: #686868;

padding: 10px 40px;

}

h1,

h2,

h3,

h4 {

text-transform: uppercase;

font-weight: 700;

letter-spacing: 0.1em;

}

h1 {

font-size: 14px;

border-bottom: 1px solid;

padding: 10px 0;

margin-bottom: 10px;

}

h2 {

margin-top: 0;

}

a {

color: #e17e66;

}

#ref {

width: 600px;

margin: 30px auto;

text-align: right;

}

#stage {

background-color: #333;

width: 600px;

height: 278px;

margin: auto;

position: relative;

-webkit-perspective: 400px;

-moz-perspective: 400px;

perspective: 400px;

}

#cube {

position: absolute;

left: 0;

right: 0;

top: 0;

bottom: 0;

margin: auto;

width: 20px;

height: 20px;

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

-webkit-transform: rotateY(30deg) translate3d(0, 60px, 0) scaleY(1) scaleX(4) scaleZ(4);

-moz-transform: rotateY(30deg) translate3d(0, 60px, 0) scaleY(1) scaleX(4) scaleZ(4);

-ms-transform: rotateY(30deg) translate3d(0, 60px, 0) scaleY(1) scaleX(4) scaleZ(4);

-o-transform: rotateY(30deg) translate3d(0, 60px, 0) scaleY(1) scaleX(4) scaleZ(4);

transform: rotateY(30deg) translate3d(0, 60px, 0) scaleY(1) scaleX(4) scaleZ(4);

-webkit-transform-style: preserve-3d;

-moz-transform-style: preserve-3d;

-ms-transform-style: preserve-3d;

-o-transform-style: preserve-3d;

transform-style: preserve-3d;

-webkit-animation: ss 1s linear infinite alternate;

-moz-animation: ss 1s linear infinite alternate;

animation: ss 1s linear infinite alternate;

}

#cube div {

width: 20px;

height: 20px;

position: absolute;

background-color: #ccc;

}

#front {

-webkit-transform: translate3d(0, 0, 10px);

-moz-transform: translate3d(0, 0, 10px);

-ms-transform: translate3d(0, 0, 10px);

-o-transform: translate3d(0, 0, 10px);

transform: translate3d(0, 0, 10px);

}

#back {

-webkit-transform: translate3d(0, 0, -10px);

-moz-transform: translate3d(0, 0, -10px);

-ms-transform: translate3d(0, 0, -10px);

-o-transform: translate3d(0, 0, -10px);

transform: translate3d(0, 0, -10px);

}

#top {

-webkit-transform: rotateX(-90deg) translate3d(0, -10px, 0);

-moz-transform: rotateX(-90deg) translate3d(0, -10px, 0);

-ms-transform: rotateX(-90deg) translate3d(0, -10px, 0);

-o-transform: rotateX(-90deg) translate3d(0, -10px, 0);

transform: rotateX(-90deg) translate3d(0, -10px, 0);

-webkit-transform-origin: center top;

-moz-transform-origin: center top;

-ms-transform-origin: center top;

-o-transform-origin: center top;

transform-origin: center top;

background-color: white !important;

}

#bottom {

-webkit-transform: rotateX(90deg) translate3d(0, 10px, 0);

-moz-transform: rotateX(90deg) translate3d(0, 10px, 0);

-ms-transform: rotateX(90deg) translate3d(0, 10px, 0);

-o-transform: rotateX(90deg) translate3d(0, 10px, 0);

transform: rotateX(90deg) translate3d(0, 10px, 0);

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

background-color: black !important;

}

#left {

-webkit-transform: rotateY(90deg) translate3d(-10px, 0, 0);

-moz-transform: rotateY(90deg) translate3d(-10px, 0, 0);

-ms-transform: rotateY(90deg) translate3d(-10px, 0, 0);

-o-transform: rotateY(90deg) translate3d(-10px, 0, 0);

transform: rotateY(90deg) translate3d(-10px, 0, 0);

-webkit-transform-origin: left center;

-moz-transform-origin: left center;

-ms-transform-origin: left center;

-o-transform-origin: left center;

transform-origin: left center;

background-color: #666 !important;

}

#right {

-webkit-transform: rotateY(-90deg) translate3d(10px, 0, 0);

-moz-transform: rotateY(-90deg) translate3d(10px, 0, 0);

-ms-transform: rotateY(-90deg) translate3d(10px, 0, 0);

-o-transform: rotateY(-90deg) translate3d(10px, 0, 0);

transform: rotateY(-90deg) translate3d(10px, 0, 0);

-webkit-transform-origin: right center;

-moz-transform-origin: right center;

-ms-transform-origin: right center;

-o-transform-origin: right center;

transform-origin: right center;

}

#topS div,

#bottomS div {

width: 2px;

height: 20px;

background-color: #ccc;

position: absolute;

}

#topS {

width: 20px;

left: 0;

right: 0;

top: 40px;

margin: auto;

background-color: red;

position: relative;

-webkit-transform-origin: center top;

-moz-transform-origin: center top;

-ms-transform-origin: center top;

-o-transform-origin: center top;

transform-origin: center top;

-webkit-animation: topSplash 2s linear infinite;

-moz-animation: topSplash 2s linear infinite;

animation: topSplash 2s linear infinite;

}

#topS div:first-child {

left: 0;

}

#topS div:nth-child(1) {

left: 50%;

-webkit-transform: scaleY(1.1);

-moz-transform: scaleY(1.1);

-ms-transform: scaleY(1.1);

-o-transform: scaleY(1.1);

transform: scaleY(1.1);

}

#topS div:last-child {

right: 0;

left: auto;

}

#bottomS {

-webkit-transform-style: preserve-3d;

-moz-transform-style: preserve-3d;

-ms-transform-style: preserve-3d;

-o-transform-style: preserve-3d;

transform-style: preserve-3d;

position: absolute;

width: 100%;

height: 100%;

background-color: transparent !important;

-webkit-transform: translateY(18px);

-moz-transform: translateY(18px);

-ms-transform: translateY(18px);

-o-transform: translateY(18px);

transform: translateY(18px);

-webkit-animation: fadeIn 2s linear infinite;

-moz-animation: fadeIn 2s linear infinite;

animation: fadeIn 2s linear infinite;

}

#bottomS div {

-webkit-transform-origin: center center;

-moz-transform-origin: center center;

-ms-transform-origin: center center;

-o-transform-origin: center center;

transform-origin: center center;

background-color: white;

}

#bottomS div:nth-child(1) {

width: 2px;

height: 5px;

-webkit-transform: rotateX(90deg) translate3d(5px, 25px, 0px);

-moz-transform: rotateX(90deg) translate3d(5px, 25px, 0px);

-ms-transform: rotateX(90deg) translate3d(5px, 25px, 0px);

-o-transform: rotateX(90deg) translate3d(5px, 25px, 0px);

transform: rotateX(90deg) translate3d(5px, 25px, 0px);

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

}

#bottomS div:nth-child(2) {

width: 2px;

height: 5px;

-webkit-transform: rotateX(90deg) translate3d(5px, -15px, 0px);

-moz-transform: rotateX(90deg) translate3d(5px, -15px, 0px);

-ms-transform: rotateX(90deg) translate3d(5px, -15px, 0px);

-o-transform: rotateX(90deg) translate3d(5px, -15px, 0px);

transform: rotateX(90deg) translate3d(5px, -15px, 0px);

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

}

#bottomS div:nth-child(3) {

width: 5px;

height: 2px;

-webkit-transform: rotateX(90deg) translate3d(30px, 5px, 0px);

-moz-transform: rotateX(90deg) translate3d(30px, 5px, 0px);

-ms-transform: rotateX(90deg) translate3d(30px, 5px, 0px);

-o-transform: rotateX(90deg) translate3d(30px, 5px, 0px);

transform: rotateX(90deg) translate3d(30px, 5px, 0px);

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

}

#bottomS div:nth-child(4) {

width: 5px;

height: 2px;

-webkit-transform: rotateX(90deg) translate3d(-10px, 0px, 0px);

-moz-transform: rotateX(90deg) translate3d(-10px, 0px, 0px);

-ms-transform: rotateX(90deg) translate3d(-10px, 0px, 0px);

-o-transform: rotateX(90deg) translate3d(-10px, 0px, 0px);

transform: rotateX(90deg) translate3d(-10px, 0px, 0px);

-webkit-transform-origin: center bottom;

-moz-transform-origin: center bottom;

-ms-transform-origin: center bottom;

-o-transform-origin: center bottom;

transform-origin: center bottom;

}

@-webkit-keyframes topSplash {

0%, 30% {

-webkit-transform: scaleY(0);

}

40% {

-webkit-transform: scaleY(4);

}

41%,

100% {

-webkit-transform: scaleY(0);

}

}

@-moz-keyframes topSplash {

0%, 30% {

-moz-transform: scaleY(0);

}

40% {

-moz-transform: scaleY(4);

}

41%,

100% {

-moz-transform: scaleY(0);

}

}

@keyframes topSplash {

0%, 30% {

-webkit-transform: scaleY(0);

-moz-transform: scaleY(0);

-ms-transform: scaleY(0);

-o-transform: scaleY(0);

transform: scaleY(0);

}

40% {

-webkit-transform: scaleY(4);

-moz-transform: scaleY(4);

-ms-transform: scaleY(4);

-o-transform: scaleY(4);

transform: scaleY(4);

}

41%,

100% {

-webkit-transform: scaleY(0);

-moz-transform: scaleY(0);

-ms-transform: scaleY(0);

-o-transform: scaleY(0);

transform: scaleY(0);

}

}

@-webkit-keyframes fadeIn {

0%, 30% {

opacity: 0;

}

38% {

opacity: 0;

}

43% {

opacity: 1;

}

49% {

opacity: 0;

}

100% {

opacity: 0;

}

}

@-moz-keyframes fadeIn {

0%, 30% {

opacity: 0;

}

38% {

opacity: 0;

}

43% {

opacity: 1;

}

49% {

opacity: 0;

}

100% {

opacity: 0;

}

}

@keyframes fadeIn {

0%, 30% {

opacity: 0;

}

38% {

opacity: 0;

}

43% {

opacity: 1;

}

49% {

opacity: 0;

}

100% {

opacity: 0;

}

}

@-webkit-keyframes ss {

0% {

-webkit-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-webkit-animation-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22);

}

73% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

}

80% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

}

100% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

}

}

@-moz-keyframes ss {

0% {

-moz-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-moz-animation-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22);

}

73% {

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

}

80% {

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

}

100% {

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

}

}

@keyframes ss {

0% {

-webkit-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-moz-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-ms-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-o-transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

transform: rotateY(180deg) translate3d(0, -100px, 0) scaleY(1);

-webkit-animation-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22);

-moz-animation-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22);

animation-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22);

}

73% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

-ms-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

-o-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(8);

}

80% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

-ms-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

-o-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(1) scaleX(1) scaleZ(1);

}

100% {

-webkit-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

-moz-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

-ms-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

-o-transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

transform: rotateY(55deg) translate3d(0, 100px, 0) scaleY(0.25) scaleX(3) scaleZ(3);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值