1234567891011121314151617181920212223242526272829303132333435363738 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <style>
- #box {
- width: 200px;
- height: 200px;
- background: red;
- transition: all 2s ease-in 5s;
- }
- #box:hover {
- width: 500px;
- height: 500px;
- background: yellow;
- }
- </style>
- </head>
- <body>
- <!--
- 动画
- 过渡效果:在一定时间内平滑的过渡
- transition:
- transition-property: 执行名称(all/width/height)
- transition-duration: 执行过渡效果时间
- transition-timing-function:运动曲线
- linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
- ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
- ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
- ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
- ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))。
- transition-delay 过渡效果何时开始。
- -->
- <div id="box"></div>
- </body>
- </html>
|