Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css3 遮罩动画 #63

Open
gaowei1012 opened this issue Dec 1, 2020 · 3 comments
Open

Css3 遮罩动画 #63

gaowei1012 opened this issue Dec 1, 2020 · 3 comments

Comments

@gaowei1012
Copy link
Owner

使用 animation css3线性动画

@gaowei1012
Copy link
Owner Author

gaowei1012 commented Dec 1, 2020

html

<div className={styles.productContent}>
            <div
                className={styles.productList} >
                <img className={styles.img} src='http://xxx' />
                <div className={styles.box}>
                  <span className={styles.listContent}>我是内容</span>
                </div>
            </div>
 </div>

@gaowei1012
Copy link
Owner Author

css

.productContent {
      min-width: 1200px;
      width: 80%;
      padding: 1rem;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-around;

      .productList {
        width: 30%;
        margin-top: 1rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        position: relative;
        overflow: hidden;
        .img {
          height: 150px;
          width: 360px;
          border-radius: 2px;
        }

        .box {
          position: absolute;
          display: none;
          height: 150px;
          width: 360px;
          border-radius: 2px;

        }
      }

      .productListNo {
        height: 150px;
        width: 30%;
      }

      // hover
      .productList:hover {
        width: 30%;
        z-index: 999;

        .box {
          overflow: hidden;
          background-color: rgba(19, 18, 18, 0.6);
          height: 150px;
          width: 360px;
          display: flex;
          opacity: .8;
          color: white;
          align-items: center;
          animation-duration: .5s;
          animation-fill-mode: both;
          animation-name: slideInFromBottom;

          .listContent {
            width: 90%;
            display: inline-block;
            margin: 0 auto;
          }
        }
      }
    }

@gaowei1012
Copy link
Owner Author

css

 // 鼠标移入动画
    @keyframes slideInFromBottom {
      from {
        opacity: .2;
        -webkit-transform: translateY(100px);
        transform: translateY(100px);
      }

      to {
        opacity: 1;
        -webkit-transform: translateY(0px);
        transform: translateY(0px);
      }
    }

@gaowei1012 gaowei1012 changed the title Css3z 遮罩动画 Css3 遮罩动画 Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant