• 57.纯 CSS 创作一双黑暗中的眼睛


    原文地址:https://segmentfault.com/a/1190000015327725

    感想:原来边框还能这样玩--》做会眨眼的眼睛

    HTML code:

    <div class="eyes">
        <span class="left"></span>
        <span class="right"></span>
    </div>

    CSS  code:

    html, body {
        margin: 0;
        padding: 0;
    }
    /* 设置body的子元素水平垂直居中 */
    body{
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: black;
    }
    /* 设置容器尺寸 */
    .eyes{
        position: relative;
        width: 40em;
        height: 10em;
        /* border: 1px solid white; */
        font-size: 12px;
    }
    .eyes > * {
        /* 设置宽高包含内边距/边框和内容 */
        box-sizing: border-box;
        position: absolute;
        width: 15em;
        height: 10em;
        border: solid white;
        /* 画眼球 */
        border-width: 0 5em;
        animation: blink 2s linear infinite;
    }
    .eyes .left{
        left: 0;
        border-radius: 50% 0;
        /* 使双眼向内聚拢 */
        transform: rotate(25deg);
    }
    .eyes .right {
        right : 0;
        border-radius: 0 50%;
        transform: rotate(-25deg);
    }
    /* 定义眨眼的动画 */
    @keyframes blink{
        40%, 60%{
            border-width: 0 5em;
        }
        50% {
            border-width: 0 7.5em;
        }
    }
  • 相关阅读:
    牛逼的博客地址
    动画的keyPath
    跳转到系统设置的各种配置
    UITextField只允许输入正数
    冒泡排序
    number类型的数组
    正则表达式
    C中常用的数学函数
    利用运行时,查看一个类的所有子类
    玉蟾宫(悬线法)
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10620121.html
Copyright © 2020-2023  润新知