栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用css制作吊扇转动的效果

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用css制作吊扇转动的效果

吊扇转动动画

原理

1、 画一个吊扇,旋转中心为吊扇几何中心

2、 使用 @keyframes 描述旋转动画,使用 animation 旋转吊扇

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Fan</title>    <style>        @keyframes run { from {     transform: rotate(0deg); } 25% {     transform: rotate(90deg); } 50% {     transform: rotate(180deg); } 75% {     transform: rotate(270deg); } to {     transform: rotate(360deg); }        }        .fan-wrap { position: relative; width: 400px; height: 400px; animation: 100ms run infinite;        }        .fan-wrap:hover { animation-play-state: paused;        }        .fan-wrap>div { background-color: pink;        }        .fan-cricle { width: 40px; height: 40px; border-radius: 40px; position: absolute; top: 180px; left: 180px;        }        .fan-leaf { width: 200px; height: 20px; position: absolute; top: 190px; left: 200px; transform-origin: 0 10px;        }        .roate-120 { transform: rotate(120deg);        }        .roate-240 { transform: rotate(240deg);        }    </style></head><body>    <div class="fan-wrap">        <div class="fan-cricle"></div>        <div class="fan-leaf"></div>        <div class="fan-leaf roate-120"></div>        <div class="fan-leaf roate-240"></div>    </div></body></html>
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/387691.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号