云端漫步 发表于 2025-9-24 15:32:00

【漫步特效】时光飞逝

<style>
#mydiv {
    margin: 130px 0 30px calc(50% - 900px);
    display: grid;
    place-items: center;
    width: 1700px;
    height: 850px;
    background: #000;
    box-shadow: 3px 3px 20px #000;
    user-select: none;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
#vid {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: .1;
    z-index: 15;
    will-change: opacity;
    backface-visibility: hidden;
}
#background-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 1;
    z-index: 4;
    top: 0;
    left: 0;
    transition: background-image 2s ease-in-out;
}
.animated-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    z-index: 5;
    will-change: opacity, transform, filter;
    backface-visibility: hidden;
    top: 0;
    left: 0;
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* &#x56FE;&#x7247;&#x80CC;&#x666F; */
#background-image,
#image1 { background-image: url('https://webftp-bbs.hnol.net/ggkj2017/yunduanmanbu/16/6/3/2dfd.jpg'); }
#image2 { background-image: url('https://webftp-bbs.hnol.net/ggkj2017/yunduanmanbu/16/6/3/3dfd.jpg'); }
#image3 { background-image: url('https://webftp-bbs.hnol.net/ggkj2017/yunduanmanbu/16/6/3/4dfd.jpg'); }
#image4 { background-image: url('https://webftp-bbs.hnol.net/ggkj2017/yunduanmanbu/16/6/3/5dfd.jpg'); }
#image5 { background-image: url('https://webftp-bbs.hnol.net/ggkj2017/yunduanmanbu/16/6/3/1dfd.jpg'); }

/* &#x5165;&#x573A;&#x52A8;&#x753B;&#x6548;&#x679C;&#x7C7B; */
.blinds { animation: blinds 10s forwards cubic-bezier(0.34, 1.56, 0.64, 1); } /* &#x5EF6;&#x957F;&#x767E;&#x53F6;&#x7A97;&#x52A8;&#x753B;&#x65F6;&#x95F4; */
.vertical-slide { animation: verticalSlide 10s forwards cubic-bezier(0.25, 0.1, 0.25, 1); }
.horizontal-scan { animation: horizontalScan 8s forwards cubic-bezier(0.34, 1.56, 0.64, 1); }
.rotate-unfold { animation: rotateUnfold 8s forwards cubic-bezier(0.34, 1.56, 0.64, 1); }
.scale-fade { animation: scaleFade 8s forwards cubic-bezier(0.34, 1.56, 0.64, 1); }

/* &#x521B;&#x610F;&#x8F6C;&#x573A;&#x7279;&#x6548; */
.pixel-dissolve { animation: pixelDissolve 4s forwards cubic-bezier(0.4, 0, 0.2, 1); }
.cube-flip { animation: cubeFlip 4s forwards cubic-bezier(0.4, 0, 0.2, 1); transform-style: preserve-3d; }
.wave-wipe { animation: waveWipe 4s forwards cubic-bezier(0.4, 0, 0.2, 1); }
.light-leak { animation: lightLeak 4s forwards cubic-bezier(0.4, 0, 0.2, 1); }
.page-curl { animation: pageCurl 4s forwards cubic-bezier(0.4, 0, 0.2, 1); transform-origin: bottom right; }
@keyframes blinds {
    0% {
      /* &#x521D;&#x59CB;&#x72B6;&#x6001;*/
      clip-path: polygon(
            0 0, 100% 0, 100% 0, 0 0,
            0 10%, 100% 10%, 100% 10%, 0 10%,
            0 20%, 100% 20%, 100% 20%, 0 20%,
            0 30%, 100% 30%, 100% 30%, 0 30%,
            0 40%, 100% 40%, 100% 40%, 0 40%,
            0 50%, 100% 50%, 100% 50%, 0 50%,
            0 60%, 100% 60%, 100% 60%, 0 60%,
            0 70%, 100% 70%, 100% 70%, 0 70%,
            0 80%, 100% 80%, 100% 80%, 0 80%,
            0 90%, 100% 90%, 100% 90%, 0 90%
      );
      opacity: 0;
    }
    20% { opacity: 0.8; }
    100% {
      /* &#x7ED3;&#x675F;&#x72B6;&#x6001; */
      clip-path: polygon(
            0 0, 100% 0, 100% 10%, 0 10%,
            0 10%, 100% 10%, 100% 20%, 0 20%,
            0 20%, 100% 20%, 100% 30%, 0 30%,
            0 30%, 100% 30%, 100% 40%, 0 40%,
            0 40%, 100% 40%, 100% 50%, 0 50%,
            0 50%, 100% 50%, 100% 60%, 0 60%,
            0 60%, 100% 60%, 100% 70%, 0 70%,
            0 70%, 100% 70%, 100% 80%, 0 80%,
            0 80%, 100% 80%, 100% 90%, 0 90%,
            0 90%, 100% 90%, 100% 100%, 0 100%
      );
      opacity: 1;
    }
}
@keyframes verticalSlide {
    0% {
      transform: translateY(100%);
      opacity: 0;
    }
    10% {
      transform: translateY(90%);
      opacity: 0.1;
    }
    30% {
      transform: translateY(60%);
      opacity: 0.4;
    }
    70% {
      transform: translateY(20%);
      opacity: 0.8;
    }
    90% {
      transform: translateY(5%);
      opacity: 0.95;
    }
    95% {
      transform: translateY(-2%);
      opacity: 1;
    }
    100% {
      transform: translateY(0);
      opacity: 1;
    }
}
@keyframes horizontalScan {
    0% { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); opacity: 0; }
    20% { opacity: 0.8; }
    100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 1; }
}
@keyframes rotateUnfold {
    0% { transform: rotate(-15deg) scale(0.7); opacity: 0; filter: brightness(0.5); }
    20% { opacity: 0.8; }
    100% { transform: rotate(0) scale(1); opacity: 1; filter: brightness(1); }
}
@keyframes scaleFade {
    0% { transform: scale(1.3); opacity: 0; filter: blur(5px); }
    20% { opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; filter: blur(0); }
}
@keyframes pixelDissolve {
    0% {
      opacity: 1;
      transform: scale(1);
      filter: pixelate(0px);
    }
    50% {
      filter: pixelate(20px);
    }
    100% {
      opacity: 0;
      transform: scale(1.1);
      filter: pixelate(40px);
    }
}
@keyframes cubeFlip {
    0% {
      opacity: 1;
      transform: rotateY(0deg) translateZ(0);
    }
    50% {
      transform: rotateY(90deg) translateZ(50px);
      opacity: 0.8;
    }
    100% {
      opacity: 0;
      transform: rotateY(180deg) translateZ(0);
    }
}
@keyframes waveWipe {
    0% {
      opacity: 1;
      clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
    100% {
      opacity: 0;
      clip-path: polygon(
            0 -50%, 100% -50%,
            calc(100% + 50px) calc(100% + 50px),
            -50px calc(100% + 50px)
      );
    }
}
@keyframes lightLeak {
    0% {
      opacity: 1;
      filter: hue-rotate(0deg) brightness(1);
    }
    50% {
      filter: hue-rotate(180deg) brightness(1.5);
    }
    100% {
      opacity: 0;
      filter: hue-rotate(360deg) brightness(0);
    }
}
@keyframes pageCurl {
    0% {
      opacity: 1;
      transform: rotate(0deg) scale(1);
    }
    100% {
      opacity: 0;
      transform: rotate(30deg) scale(0.8);
      filter: brightness(0.5);
    }
}
.animated-image {
    animation-fill-mode: forwards;
}
/* &#x89C6;&#x9891;&#x52A0;&#x8F7D;&#x72B6;&#x6001; */
#video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    color: white;
    display: none;
}
#video-loading::after {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin: 10px auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@supports not (filter: pixelate(0px)) {
    @keyframes pixelDissolve {
      0% {
            opacity: 1;
            transform: scale(1);
            image-rendering: auto;
      }
      100% {
            opacity: 0;
            transform: scale(1.1);
            image-rendering: pixelated;
      }
    }
}
</style>
<div id="mydiv">
    <audio id="aud" src="https://mp3.joy127.com/music/12494.mp3" autoplay loop></audio>
    <div id="video-loading">&#x89C6;&#x9891;&#x52A0;&#x8F7D;&#x4E2D;...</div>
    <video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/02/03/5b4f2ae929323.mp4"
         autoplay loop muted preload="auto" playsinline>
    </video>
      <!-- &#x6253;&#x5E95;&#x56FE;&#x7247; -->
    <div id="background-image"></div>
      <!-- &#x4E94;&#x5F20;&#x52A8;&#x753B;&#x56FE;&#x7247; -->
    <div id="image1" class="animated-image"></div>
    <div id="image2" class="animated-image"></div>
    <div id="image3" class="animated-image"></div>
    <div id="image4" class="animated-image"></div>
    <div id="image5" class="animated-image"></div>
</div>
<script>
// &#x56FE;&#x7247;&#x548C;&#x52A8;&#x753B;&#x914D;&#x7F6E;
const images = [
    { id: 'image1', animation: 'blinds', name: '&#x7B2C;&#x4E00;&#x5F20;&#x56FE;&#xFF08;&#x767E;&#x53F6;&#x7A97;&#x6548;&#x679C;&#xFF09;' },
    { id: 'image2', animation: 'vertical-slide', name: '&#x7B2C;&#x4E8C;&#x5F20;&#x56FE;&#xFF08;&#x5782;&#x76F4;&#x6ED1;&#x52A8;&#xFF09;' },
    { id: 'image3', animation: 'horizontal-scan', name: '&#x7B2C;&#x4E09;&#x5F20;&#x56FE;&#xFF08;&#x6C34;&#x5E73;&#x626B;&#x63CF;&#xFF09;' },
    { id: 'image4', animation: 'rotate-unfold', name: '&#x7B2C;&#x56DB;&#x5F20;&#x56FE;&#xFF08;&#x65CB;&#x8F6C;&#x5C55;&#x5F00;&#xFF09;' },
    { id: 'image5', animation: 'scale-fade', name: '&#x7B2C;&#x4E94;&#x5F20;&#x56FE;&#xFF08;&#x7F29;&#x653E;&#x6DE1;&#x5165;&#xFF09;' }
];
// &#x521B;&#x610F;&#x8F6C;&#x573A;&#x7279;&#x6548;&#x5217;&#x8868;
const transitionEffects = [
    'pixel-dissolve',// &#x50CF;&#x7D20;&#x5316;&#x6EB6;&#x89E3;&#x6548;&#x679C;
    'cube-flip',       // &#x7ACB;&#x4F53;&#x7FFB;&#x8F6C;&#x6548;&#x679C;
    'wave-wipe',       // &#x6CE2;&#x6D6A;&#x64E6;&#x62ED;&#x6548;&#x679C;
    'light-leak',      // &#x5149;&#x7EBF;&#x6CC4;&#x6F0F;&#x6548;&#x679C;
    'page-curl'      // &#x9875;&#x9762;&#x5377;&#x66F2;&#x6548;&#x679C;
];
let currentIndex = 0;
const animationDuration = 18000; // &#x6574;&#x4F53;&#x52A8;&#x753B;&#x6301;&#x7EED;&#x65F6;&#x95F4;
const transitionDuration = 4000; // &#x8FC7;&#x6E21;&#x52A8;&#x753B;&#x65F6;&#x95F4;
let isVideoReady = false;
let animationFrameId = null;
// &#x521D;&#x59CB;&#x5316;&#x89C6;&#x9891;
const video = document.getElementById('vid');
const videoLoading = document.getElementById('video-loading');
// &#x89C6;&#x9891;&#x52A0;&#x8F7D;&#x4F18;&#x5316;
function initVideo() {
    videoLoading.style.display = 'block';
   
    video.addEventListener('canplay', () => {
      isVideoReady = true;
      videoLoading.style.display = 'none';
      startSlideshow();
    });
   
    video.addEventListener('error', () => {
      console.error('&#x89C6;&#x9891;');
      videoLoading.textContent = '&#x89C6;&#x9891;';
    });
    video.load();
}
function initImages() {
    images.forEach(img => {
      const element = document.getElementById(img.id);
      if (element) {
            element.style.opacity = 0;
            element.classList.remove(img.animation);
            transitionEffects.forEach(effect => {
                element.classList.remove(effect);
            });
      }
    });
}
function getRandomEffect() {
    const randomIndex = Math.floor(Math.random() * transitionEffects.length);
    return transitionEffects;
}
function showNextImage() {
    if (!isVideoReady) {
      setTimeout(showNextImage, 100);
      return;
    }
   if (animationFrameId) {
      cancelAnimationFrame(animationFrameId);
    }
      const currentImage = document.getElementById(images.id);
    if (!currentImage) {
      console.error(`&#x56FE;&#x7247;&#x5143;&#x7D20; `);
      return;
    }
    const prevIndex = (currentIndex - 1 + images.length) % images.length;
    const prevImage = document.getElementById(images.id);
    currentImage.style.zIndex = 10;
    if (prevImage) {
      prevImage.style.zIndex = 9;
    }
       animationFrameId = requestAnimationFrame(() => {
      currentImage.style.opacity = 0;
      currentImage.classList.remove(images.animation);
      currentImage.offsetHeight;
      
      currentImage.classList.add(images.animation);
      
      requestAnimationFrame(() => {
            currentImage.style.opacity = 1;
      });
    });
      if (prevImage) {
      transitionEffects.forEach(effect => {
            prevImage.classList.remove(effect);
      });
         const delay = 1000;
      setTimeout(() => {
            requestAnimationFrame(() => {
                const randomEffect = getRandomEffect();
                prevImage.classList.add(randomEffect);
               
                // &#x4E3A;3D&#x6548;&#x679C;&#x6DFB;&#x52A0;&#x5BB9;&#x5668;&#x900F;&#x89C6;
                if (randomEffect === 'cube-flip') {
                  prevImage.parentElement.style.perspective = '1000px';
                } else {
                  prevImage.parentElement.style.perspective = '';
                }
            });
      }, delay);
    }
      const backgroundImage = document.getElementById('background-image');
    if (backgroundImage && currentImage.style.backgroundImage) {
      setTimeout(() => {
            backgroundImage.style.backgroundImage = currentImage.style.backgroundImage;
      }, transitionDuration / 1.5);
    }
       const nextDelay = animationDuration - transitionDuration;
   
    currentIndex = (currentIndex + 1) % images.length;
    setTimeout(showNextImage, nextDelay);
}
function startSlideshow() {
    setTimeout(() => {
      const firstImage = document.getElementById(images.id);
      if (firstImage) {
            firstImage.style.zIndex = 10;
            firstImage.classList.add(images.animation);
            requestAnimationFrame(() => {
                firstImage.style.opacity = 1;
            });
      }
      setTimeout(showNextImage, animationDuration - transitionDuration);
    }, 100);
}
window.addEventListener('unload', () => {
    if (animationFrameId) {
      cancelAnimationFrame(animationFrameId);
    }
});
initImages();
initVideo();
</script>

云端漫步 发表于 2025-9-24 15:32:41

特效音画代码包括七个创意转场。百叶窗效果、像素化溶解效果、 立体翻转效果、波浪擦拭效果、
光线泄漏效果、页面卷曲效果、缩放淡入效果,随着音乐节奏循环往复。

玫の玫 发表于 2025-9-24 18:59:56

欣赏漫步老师美作,感谢精彩分享,感谢给大家带来美滴享受!祝创作愉快,天天好心情!

玫の玫 发表于 2025-9-24 19:05:10

特效效果美美哒,女子的灵动姿态与时钟、年份数字相衬,让 “时光飞逝” 的主题更具视觉冲击力,也更易引发人们对时光的思考。

玫の玫 发表于 2025-9-24 19:05:38

整体画面色彩绚丽,充满动感,仿佛在生动展现时光流逝的迅疾与活力。{:1_154:}

绿蔷薇 发表于 2025-9-24 19:21:42

好有时尚感的设计制作,七个创意转场流畅自然,图意与特效非常彰显了时光飞逝的主题意境~~~

绿蔷薇 发表于 2025-9-24 19:23:11

漫步老师制作的棒棒哒,辛苦了,谢谢带来的精彩 ~~~{:5_130:}

绿蔷薇 发表于 2025-9-24 19:23:56

祝漫步老师创作愉快,秋日安康~~~{:1_153:}

欧阳风刀 发表于 2025-9-24 20:52:21

时尚的设计,色彩搭配漂亮,图片转页效果精彩!

欧阳风刀 发表于 2025-9-24 20:52:56

欣赏学习。感谢漫步兄精心制作分享!:handshake
页: [1] 2
查看完整版本: 【漫步特效】时光飞逝