遮罩

作者: 唔哈哈哈哈 | 来源:发表于2021-07-16 17:26 被阅读0次

遮罩

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>遮罩</title>
        <style type="text/css">
            .box{
                width: 250px;
                height: 250px;
                border: 5px  solid #fff;
                border-radius: 50%;
                box-shadow: 0 0 5px  #f00;
                position: relative;
            }
            
            .box  img{
                width: 100%;
                height: 100%;
                border-radius: 50%;
            }
            
            .box .cover{
                width: 100%;
                height: 100%;
                background-color: rgba(0,0,0,0.5);
                border-radius: 50%;
                text-align: center;
                line-height: 250px;
                font-size: 25px;
                color: #fff;
                position: absolute;
                left: 0;
                top: 0;
                opacity: 0;
            }
            
            /* .box:hover .cover{ */
            .cover:hover{
                opacity: 1;
                transition: opacity 1s;  
            }
        </style>
    </head>
    <body>
        <div class="box">
            <img src="images/pic3.jpg" alt="">
            
            <!-- 遮罩层 -->
            <div class="cover">
                更换头像
            </div>
        </div>
    </body>
</html>

其它遮罩

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>其它遮罩</title>
        <style>
            .box{
                width: 250px;
                height: 250px;
                border: 5px  solid #fff;
                border-radius: 50%;
                box-shadow: 0 0 5px  #f00;
                position: relative;
                margin-top: 10px;
                position: relative;
            }
            
            .box  img{
                width: 100%;
                height: 100%;
                border-radius: 50%;
            }
            
            /* 设置遮罩层的公共样式 */
            .box1{
                width: 100%;
                height: 100%;
                border-radius: 50%;
                background-color: rgba(0,0,0,0.5);
                text-align: center;
                line-height: 250px;
                font-size: 25px;
                color: #fff;
                position: absolute;
                left: 0;
                top: 0;
                opacity: 0;
            }
            /* 设置第一个遮罩层效果 */
            .box  .cover1{
                transform: translate(-260px);
            }
            
            .box:hover .cover1{
                opacity: 1;
                transform: translate(0px);
                transition: opacity 2s,transform 2s;
            }
            
            /* 处理第二个遮罩层效果 */
            .box  .cover2{
                transform: scale(0);
            }
            .box:hover .cover2{
                opacity: 1;
                transform: scale(1);
                transition: opacity 2s,transform 2s;
            }
            /* 处理第三个遮罩层效果 */
            .box  .cover3{
                transform: scale(0) rotate(360deg);
            }
            .box:hover .cover3{
                opacity: 1;
                transform: scale(1) rotate(0deg);
                transition: opacity 2s,transform 2s;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <img src="./images/pic3.jpg" alt="">
            <div class="box1 cover1">
                更换头像
            </div>
        </div>
        
        <div class="box">
            <img src="./images/pic3.jpg" alt="">
            <div class="box1 cover2">
                更换头像
            </div>
        </div>
        
        <div class="box">
            <img src="./images/pic3.jpg" alt="">
            <div class="box1 cover3">
                更换头像
            </div>
        </div>
    </body>
</html>


相关文章

  • 遮罩

    遮罩 其它遮罩

  • Pr19-Premiere特效滤镜:键控-轨道遮罩

    效果-键控-轨道遮罩键:上图形,下背景 文字层在上方:遮罩层 背景层在下方:被遮罩层 给被遮罩层添加“轨道遮罩键”...

  • Axure实现遮罩效果

    很多时候我们在编辑视频的时候经常需要用到遮罩的效果,一般制作遮罩动画,就是指一个遮罩层同时遮罩多个被遮罩层的遮罩动...

  • 【工具教程集】ZBrush中的实时遮罩

    在ZBrush中有许多遮罩类型,包括柔滑遮罩、反转遮罩,实时遮罩等。其中,实时遮罩又包含很多种类,它不同于一般的遮...

  • Swift 添加两种遮罩的方式

    没有遮罩前的效果 代码实现 遮罩方式一 代码实现 遮罩方式二 代码实现 实战 -- 二维码扫描区域遮罩 代码实现 ...

  • UI跟随鼠标移动

    遮罩面板 遮罩面板的重写 点击传递事件

  • cocos2dx遮罩

    遮罩是很多地方都能用到的东西,新手教程,截图等等,都能用遮罩来实现。 遮罩的原理知其然,知其所以然。遮罩其实可以理...

  • 放大镜效果

    核心原理1、鼠标经过遮罩层显示,离开隐藏;2、移动鼠标遮罩层跟随,鼠标超出大盒子后遮罩层不跟随出框;3、移动遮罩层...

  • 遮罩层实现

    代码如下 实现效果:点击按钮,显示遮罩层,弹出弹框点击遮罩层,隐藏遮罩层,隐藏弹框

  • iOS中的图片遮罩处理

    光影遮罩 这里我分类深色与浅色遮罩,效果是什么样呢,可以看下面的图片,第一张是原图,后面是遮罩图。 深色遮罩 浅色...

网友评论

      本文标题:遮罩

      本文链接:https://www.haomeiwen.com/subject/vqpbpltx.html