用css制作风车(新手版)

弄出扇叶,直接用动画旋转装了扇叶的盒子代码如下:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>feng</title>

</head>

<style>

    body{

        background-color: black;

    }

    .wrap{

        width: 700px;

        height: 700px;

       margin: 200px auto;

       position: relative;

    }

    /* 风扇叶子整体 */

    .wrap_box1{

        position: relative;

        width: 300px;

        height: 300px;

        z-index: 2;

        animation: change 2s linear infinite;

    }

    /* 动画 */

    @keyframes change{

        100%{

            transform: rotate(360deg);

        }

    }

    /* 风扇叶子 */

    .feng1 ,.feng2,.feng3,.feng4{

        width: 70px;

        height: 50px;

        border-radius:0 50% 0 50%;

        /* 叶子颜色渐变也 */

        background:linear-gradient(red,rgb(225, 0, 255));    

    }

    .feng1 {

        position: absolute;

        top: 80px;

        left: 123px;

  /* 调整扇叶角度 */

        transform: rotate(66deg);

        /* 可单独给每个叶子设置一个颜色 */

        /* background-color: rgb(236, 12, 12);    */

    }

    .feng2{

        position: absolute;

        top: 135px;

        left: 160px;

        transform: rotate(160deg);

        /* background-color: rgb(231, 143, 12); */  

    }

    .feng3 {

        position: absolute;

        top: 171px;

        left: 108px;

        transform: rotate(246deg);

        /* background-color: rgb(45, 16, 212); */

    }

    .feng4{

        position: absolute;

        position: absolute;

        top: 120px;

        left: 67px;

        /* background-color: rgb(241, 13, 165); */

        transform: rotate(336deg);

    }

    /* 中间的原点 */

    .yuan{

        position: absolute;

        top: 140px;

        left: 140px;

        width: 20px;

        height: 20px;

        border-radius:50%;

        background-color: rgb(165, 233, 7);

    }

    /* 柱子 */

    .zhu{

        position: absolute;

        top: 150px;

        left: 145px;

        width: 5px;

        height: 200px;

        background-color: green;

    }

</style>

<body>

    <div class="wrap">

        <div class="wrap_box1">

            <div class="feng1"></div>

            <div class="feng2"></div>

            <div class="feng3"></div>

            <div class="feng4"></div>

            <div class="yuan"></div>

        </div>

        <div class="zhu"></div>

    </div>

</body>

</html>

运行后是动态的,插入的图片为静态截图   

  • 24
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值