You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调整现有Reveal Image Animation代码以匹配目标网站动画效果

Adjusted Code for Milanollc-Style Image Reveal Animation

Here's the modified code that matches the reveal animation from the reference site:

<!DOCTYPE html>
<html>
<head>
    <style>
        .image-container {
            position: relative;
            width: 600px;
            height: 400px;
            margin: 100vh auto;
            overflow: hidden;
        }

        .image-container img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #ffffff;
            z-index: 2;
            transform: translateX(0);
            transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1);
        }

        .image-container.in-view .overlay {
            transform: translateX(100%);
        }
    </style>
</head>
<body>
    <div class="image-container">
        <img src="https://assets.zyrosite.com/AR0exeRVKXF4KQNo/w10-YbNbRanwNRF6lPw4.png" alt="Your Image">
        <div class="overlay"></div>
    </div>

    <script>
        const observer = new IntersectionObserver((entries) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    entry.target.classList.add('in-view');
                }
            });
        }, { threshold: 0.1 });

        document.querySelectorAll('.image-container').forEach(container => {
            observer.observe(container);
        });
    </script>
</body>
</html>

Key Changes Made:

  • Overlay Color: Swapped dark semi-transparent background for solid white (#ffffff) to match the reference site's design.
  • Animation Mechanism: Replaced scaleX transform with translateX to create a smooth horizontal slide-off effect, aligning with the reference's wipe animation.
  • Scroll Trigger: Added Intersection Observer to start the animation when the image enters the viewport, mirroring the reference's scroll-activated reveal.
  • Timing Curve: Used cubic-bezier(0.77, 0, 0.175, 1) for a natural, polished animation flow.
  • Container Dimensions: Adjusted size to better match the reference site's image proportions.

内容的提问来源于stack exchange,提问作者B Mahfoud

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 02:43:25