css动画- 热点图案例

 1.body部分(写好我们的框架)


    <div>
        <div class="dotted"></div>
        <div class="pulse1"> </div>
        <div class="pulse2"> </div>
        <div class="pulse3"> </div>
    </div>

2.css部分

 div {
            width: 200px;
            height: 300px;
            background-color: #696969;
            position: relative;
        }

        div.dotted {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 10px;
            height: 10px;
            background-color: pink;
            border-radius: 50%;
            font-size: 0;

        }

        div div[class^=pulse] {
            transform: translate(-50%, -50%);
            position: absolute;
            top: 50%;
            left: 50%;
            width: 10px;
            height: 10px;
            background-color: transparent;
            border-radius: 50%;
            box-shadow: 0px 0px 4px pink;
            animation: move 1.2s linear infinite;
        }

        @keyframes move {

            0% {
                /* transform: scale(1);
                一般不用scale,因为会把阴影一起放大 不好看 */
            }

            75% {
                width: 30px;
                height: 30px;
                opacity: 1;
            }

            100% {
                width: 50px;
                height: 50px;
                opacity: 0;
            }
        }

        div div.pulse2 {
            animation-delay: 0.4s;
        }

        div div.pulse3 {
            animation-delay: 0.8s;
        }
    </style>

 3.最终可以做成波纹动画

特别注意:transform:translate使居中样式更灵活!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值