遮罩旋转进场

2018-08-21  本文已影响0人  张冬昱

1.方块div平面旋转

代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .cover
        {
            width: 100px;
            height: 100px;
            background: palevioletred;
            transition: all 2s;
            transform-origin:right bottom;

        }
        .cover:hover
        {
            transform: rotate(90deg);
        }
    </style>
</head>
<body>
    <div class="cover">
        
    </div>
</body>
</html>
效果展示

2.封面div平面旋转

代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box
        {
            width: 200px;
            height: 200px;

        }
        .bg-img
        {
            width: 200px;
            height: 200px;
            background: url("img/img-7f3a16e0d3745165410adeb572353510.jpg") no-repeat center center;
            background-size: cover;
        }
        .cover
        {
            width: 200px;
            height: 200px;
            position: absolute;
            left: 8px;
            top: 8px;
            background: rgba(255, 255, 255, 0.4);
            transform: rotate(90deg);
            transition: all 1s;
            transform-origin: right bottom;
        }
        .box:hover .cover
        {
            transform: rotate(0deg);
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="bg-img"></div>
        <div class="cover"></div>
    </div>
</body>
</html>
效果展示

3.遮罩360°旋转进场

代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box
        {
            width: 200px;
            height: 200px;
            position: relative;
            overflow: hidden;
            background-color: brown;
        }
        .cover
        {
            width: 0;
            height: 0;
            background: rgba(255, 255, 255, 0.4);
            position: absolute;
            transition: all 1s;
            transform: rotate(360deg);
            transform-origin: center center;
        }
        .box:hover .cover
        {
            width: 200px;
            height: 200px;
            transform: rotate(0);
        }
    
    </style>
</head>
<body>
    <div class="box">
        <div class="cover"></div>
    </div>
</body>
</html>
效果展示
上一篇 下一篇

猜你喜欢

热点阅读