<span id="uijqh"></span>
  • <li id="uijqh"><legend id="uijqh"></legend></li>
    \n
    \n\n\n\n\n\n
    body {\n  font-family: \"Lucida Sans\";\n  background-color: #000;\n}\n\n.works {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n  padding-bottom: 250px;\n  position: relative;\n}\n\n.works .container-works {\n  width: 1200px;\n  max-width: 100%;\n  padding: 0 15px;\n  margin: auto;\n}\n\n.works .content-works {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n}\n\n.works .header-works {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n  padding-bottom: 35px;\n  border-bottom: 1px solid #ffffff;\n}\n\n.works .header-works h3 {\n  font-size: 26px;\n  color: #fff;\n}\n\n.works #gallery-work {\n  position: fixed;\n  width: 385px;\n  height: 280px;\n  transform: translateY(-50%, 50%);\n  z-index: 999;\n  overflow: hidden;\n  pointer-events: none;\n  transition: all cubic-bezier(0.19, 1, 0.22, 1) 2s;\n}\n\n.works #work-images {\n  width: 100%;\n  height: calc(280px * 3);\n  display: flex;\n  flex-direction: column;\n  transition: all cubic-bezier(0.19, 1, 0.22, 1) 2s;\n}\n\n.works .work-image {\n  width: 100%;\n  height: 100%;\n  background-size: cover;\n  background-position: center;\n}\n\n.works .grid-works {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n}\n\n.works .grid-works .item-work {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n  padding: 40px 0;\n  border-bottom: 1px solid #fff;\n  opacity: 0.6;\n  -webkit-transition: 0.5s;\n  transition: 0.5s;\n  cursor: pointer;\n  position: relative;\n  z-index: 2;\n}\n\n.works .grid-works .item-work .title {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: vertical;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: column;\n  flex-direction: column;\n}\n\n.works .grid-works .item-work:hover {\n  opacity: 1;\n}\n\n.works .grid-works .item-work h4 {\n  font-size: 26px;\n  line-height: 40px;\n  color: #fff;\n}\n<\/pre>\n\n\n\n\n\n
    const elementsWorks = document.querySelectorAll(\".item-work\");\nconst slidePicWorks = document.querySelector(\"#gallery-work\");\nconst slidePicsWorks = document.querySelector(\"#work-images\");\n\ngsap.set(slidePicWorks, { autoAlpha: 0 });\n\nelementsWorks.forEach((element, index) => {\n  element.addEventListener(\"mouseenter\", function () {\n    gsap.to(slidePicsWorks, {\n      marginTop: `-${280 * index}px`,\n      duration: 0.2,\n      ease: \"power1\",\n    });\n  });\n\n  element.addEventListener(\"mouseleave\", function () {\n    gsap.to(element, { color: \"initial\", duration: 0.2, ease: \"power1\" });\n  });\n});\n\nwindow.addEventListener(\"mousemove\", function (e) {\n  gsap.to(slidePicWorks, {\n    top: `${e.clientY}px`,\n    left: `${e.clientX}px`,\n    xPercent: -20,\n    yPercent: -45,\n    duration: 0.2,\n    ease: \"power1\",\n  });\n});\n\ndocument\n  .querySelector(\".items-works\")\n  .addEventListener(\"mouseenter\", function () {\n    gsap.to(slidePicWorks, {\n      autoAlpha: 1,\n      duration: 0.2,\n      ease: \"power1\",\n    });\n  });\n\ndocument\n  .querySelector(\".items-works\")\n  .addEventListener(\"mouseleave\", function () {\n    gsap.to(slidePicWorks, {\n      autoAlpha: 0,\n      duration: 0.2,\n      ease: \"power1\",\n    });\n  });\n<\/pre>\n\n\n\n

    If you find It useful don't forget to Like and Follow for more.<\/p>\n\n\n \n\n \n "}

    国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

    Home Web Front-end CSS Tutorial Image Reveal Animation with HTML, CSS, and GSAP

    Image Reveal Animation with HTML, CSS, and GSAP

    Nov 24, 2024 pm 02:55 PM

    Image Reveal Animation with HTML, CSS, and GSAP

    This article demonstrates a simple image reveal animation when hovering over items. The HTML code represents a section with works, including images and titles. The CSS code provides the necessary styling for the layout and animation. The JavaScript code utilizes the GSAP library to create the image reveal effect on hover.

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Image Reveal Animation</title>
      <link rel="stylesheet" href="styles.css">
    </head>
    <body>
      <section>
    
    
    
    
    
    <pre class="brush:php;toolbar:false">body {
      font-family: "Lucida Sans";
      background-color: #000;
    }
    
    .works {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      padding-bottom: 250px;
      position: relative;
    }
    
    .works .container-works {
      width: 1200px;
      max-width: 100%;
      padding: 0 15px;
      margin: auto;
    }
    
    .works .content-works {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
    }
    
    .works .header-works {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      padding-bottom: 35px;
      border-bottom: 1px solid #ffffff;
    }
    
    .works .header-works h3 {
      font-size: 26px;
      color: #fff;
    }
    
    .works #gallery-work {
      position: fixed;
      width: 385px;
      height: 280px;
      transform: translateY(-50%, 50%);
      z-index: 999;
      overflow: hidden;
      pointer-events: none;
      transition: all cubic-bezier(0.19, 1, 0.22, 1) 2s;
    }
    
    .works #work-images {
      width: 100%;
      height: calc(280px * 3);
      display: flex;
      flex-direction: column;
      transition: all cubic-bezier(0.19, 1, 0.22, 1) 2s;
    }
    
    .works .work-image {
      width: 100%;
      height: 100%;
      background-size: cover;
      background-position: center;
    }
    
    .works .grid-works {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
    }
    
    .works .grid-works .item-work {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      padding: 40px 0;
      border-bottom: 1px solid #fff;
      opacity: 0.6;
      -webkit-transition: 0.5s;
      transition: 0.5s;
      cursor: pointer;
      position: relative;
      z-index: 2;
    }
    
    .works .grid-works .item-work .title {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
    }
    
    .works .grid-works .item-work:hover {
      opacity: 1;
    }
    
    .works .grid-works .item-work h4 {
      font-size: 26px;
      line-height: 40px;
      color: #fff;
    }
    
    const elementsWorks = document.querySelectorAll(".item-work");
    const slidePicWorks = document.querySelector("#gallery-work");
    const slidePicsWorks = document.querySelector("#work-images");
    
    gsap.set(slidePicWorks, { autoAlpha: 0 });
    
    elementsWorks.forEach((element, index) => {
      element.addEventListener("mouseenter", function () {
        gsap.to(slidePicsWorks, {
          marginTop: `-${280 * index}px`,
          duration: 0.2,
          ease: "power1",
        });
      });
    
      element.addEventListener("mouseleave", function () {
        gsap.to(element, { color: "initial", duration: 0.2, ease: "power1" });
      });
    });
    
    window.addEventListener("mousemove", function (e) {
      gsap.to(slidePicWorks, {
        top: `${e.clientY}px`,
        left: `${e.clientX}px`,
        xPercent: -20,
        yPercent: -45,
        duration: 0.2,
        ease: "power1",
      });
    });
    
    document
      .querySelector(".items-works")
      .addEventListener("mouseenter", function () {
        gsap.to(slidePicWorks, {
          autoAlpha: 1,
          duration: 0.2,
          ease: "power1",
        });
      });
    
    document
      .querySelector(".items-works")
      .addEventListener("mouseleave", function () {
        gsap.to(slidePicWorks, {
          autoAlpha: 0,
          duration: 0.2,
          ease: "power1",
        });
      });
    

    If you find It useful don't forget to Like and Follow for more.

    The above is the detailed content of Image Reveal Animation with HTML, CSS, and GSAP. For more information, please follow other related articles on the PHP Chinese website!

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How can I include CSS only on some pages? How can I include CSS only on some pages? Jun 11, 2025 am 12:01 AM

    There are three ways to selectively include CSS on a specific page: 1. Inline CSS, suitable for pages that are not frequently accessed or require unique styles; 2. Load external CSS files using JavaScript conditions, suitable for situations where flexibility is required; 3. Containment on the server side, suitable for scenarios using server-side languages. This approach can optimize website performance and maintainability, but requires balance of modularity and performance.

    Flexbox vs Grid: Understanding the Key Differences in CSS Layout Flexbox vs Grid: Understanding the Key Differences in CSS Layout Jun 10, 2025 am 12:03 AM

    Flexboxisidealforone-dimensionallayouts,whileGridsuitstwo-dimensional,complexlayouts.UseFlexboxforaligningitemsinasingleaxisandGridforprecisecontroloverrowsandcolumnsinintricatedesigns.

    Creating an Auto-Closing Notification With an HTML Popover Creating an Auto-Closing Notification With an HTML Popover Jun 10, 2025 am 09:45 AM

    The HTML popover attribute transforms elements into top-layer elements that can be opened and closed with a button or JavaScript. Popovers can be dismissed a number of ways, but there is no option to auto-close them. Preethi has a technique you can u

    What is 'render-blocking CSS'? What is 'render-blocking CSS'? Jun 24, 2025 am 12:42 AM

    CSS blocks page rendering because browsers view inline and external CSS as key resources by default, especially with imported stylesheets, header large amounts of inline CSS, and unoptimized media query styles. 1. Extract critical CSS and embed it into HTML; 2. Delay loading non-critical CSS through JavaScript; 3. Use media attributes to optimize loading such as print styles; 4. Compress and merge CSS to reduce requests. It is recommended to use tools to extract key CSS, combine rel="preload" asynchronous loading, and use media delayed loading reasonably to avoid excessive splitting and complex script control.

    How to use Lotties in Figma How to use Lotties in Figma Jun 14, 2025 am 10:17 AM

    In the following tutorial, I will show you how to create Lottie animations in Figma. We'll use two colorful designs to exmplify how you can animate in Figma, and then I'll show you how to go from Figma to Lottie animations. All you need is a free Fig

    Breaking Boundaries: Building a Tangram Puzzle With (S)CSS Breaking Boundaries: Building a Tangram Puzzle With (S)CSS Jun 13, 2025 am 11:33 AM

    We put it to the test and it turns out Sass can replace JavaScript, at least when it comes to low-level logic and puzzle behavior. With nothing but maps, mixins, functions, and a whole lot of math, we managed to bring our Tangram puzzle to life, no J

    External vs. Internal CSS: What's the Best Approach? External vs. Internal CSS: What's the Best Approach? Jun 20, 2025 am 12:45 AM

    ThebestapproachforCSSdependsontheproject'sspecificneeds.Forlargerprojects,externalCSSisbetterduetomaintainabilityandreusability;forsmallerprojectsorsingle-pageapplications,internalCSSmightbemoresuitable.It'scrucialtobalanceprojectsize,performanceneed

    Does my CSS must be on lower case? Does my CSS must be on lower case? Jun 19, 2025 am 12:29 AM

    No,CSSdoesnothavetobeinlowercase.However,usinglowercaseisrecommendedfor:1)Consistencyandreadability,2)Avoidingerrorsinrelatedtechnologies,3)Potentialperformancebenefits,and4)Improvedcollaborationwithinteams.

    See all articles