查看: 1979|回复: 64

[特效] 中了3d的毒

[复制链接]

一坛酒

樱果相依
发表于 2024-5-22 11:25 | 显示全部楼层 |阅读模式
本帖最后由 凡哥 于 2024-5-22 12:43 编辑

评分

11

查看全部评分

点评
回复

使用道具

一坛酒

樱果相依
 楼主| 发表于 2024-5-22 11:25 | 显示全部楼层
本帖最后由 凡哥 于 2024-5-22 11:28 编辑

帖子代码:
  1. <style>
  2.     .pa { margin: 20px 0 20px calc(50% - 730px); width: 1280px; height: 720px; background: url('https://638183.freep.cn/638183/t24/2/3dp.jpg') no-repeat center/cover; box-shadow: 3px 3px 6px gray; border-radius: 6px; z-index: 1; position: relative; }
  3.     #lzpa { position: absolute; left: calc(50% - 200px); top: 60px; width: 400px; height: 240px; cursor: pointer; }
  4.     #lzpa:hover #vid { transform: scale(1.5, 1.2); }
  5.     li-zi { position: absolute; width: 30px; height: 30px; border-radius: 0 100%; box-shadow: -1px -1px 6px rgba(255,255,255,.6); opacity: .8; offset-path: path('M0 120 A200 120 0 1 1 400 120 A200 120 0 1 1 0 120'); animation: move 20s linear infinite var(--state), size 20s linear infinite var(--state); }
  6.     #vid { position: absolute; left: calc(50% - 80px); top: calc(50% - 80px); width: 160px; height: 160px; border-radius:50%; object-fit: cover; pointer-events: none; mix-blend-mode: color-dodge; transition: 2s; }
  7.     @keyframes move { to { offset-distance: 100%; } }
  8.     @keyframes size { 0%, 50%, 100% { transform: scale(1) rotateY(20deg); } 25% { transform: scale(0.5)  rotateY(10deg); } 75% { transform: scale(1.5)  rotateY(30deg); } }
  9. </style>

  10. <div class="pa">
  11.     <div id="lzpa"><video id="vid" src="https://img.tukuppt.com/video_show/2402760/00/01/32/5b3f6022657ac.mp4" autoplay loop muted></video></div>
  12.     <audio id="aud" src="https://music.163.com/song/media/outer/url?id=865040132" autoplay loop></audio>
  13. </div>

  14. <script>
  15.     var total = 12;
  16.     for(var i = 0; i < total; i ++) {
  17.         let lz = document.createElement('li-zi');
  18.         lz.style.cssText += `
  19.             animation-delay: -${20 / total * i}s;
  20.             background-color: #${Math.random().toString(16).substring(2, 8)};
  21.         `;
  22.         lzpa.appendChild(lz);
  23.     }

  24.     var mState = () => {
  25.         lzpa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
  26.         aud.paused ? vid.pause() : vid.play();
  27.     };

  28.     aud.onplaying = aud.onpause = () => mState();

  29.     lzpa.onclick = () => aud.paused ? aud.play() : aud.pause();
  30. </script>
复制代码

评分

8

查看全部评分

点评
回复

使用道具

发表于 2024-5-22 11:50 | 显示全部楼层
哎呦看起来不错哒 !
点评
回复

使用道具

发表于 2024-5-22 11:50 | 显示全部楼层
本帖最后由 碧海 于 2024-5-22 14:39 编辑

这楼发代码帖子,影响一楼效果,不好意思,我把代码编辑掉了
点评
回复

使用道具

发表于 2024-5-22 11:50 | 显示全部楼层
哎呦漂亮啊!
点评
回复

使用道具

一坛酒

樱果相依
 楼主| 发表于 2024-5-22 12:38 | 显示全部楼层

蒲团楼影响了一楼的效果
点评
回复

使用道具

发表于 2024-5-22 13:30 | 显示全部楼层
凡哥 发表于 2024-5-22 12:38
蒲团楼影响了一楼的效果

这代码写的不错
点评
回复

使用道具

金老虎

两周年庆 一叶知秋 樱果相依
发表于 2024-5-22 13:49 | 显示全部楼层
哇塞,又一个代码高手哦,帖子真漂亮。给静图增加了灵动性
点评
回复

使用道具

万水千山总是情

望月兔

新春美食 版主勋章 江湖之上 江湖靓女 桃花朵朵 山高为峰 山外有山 巳巳如意 两周年庆 守望千山 少年歌行 海洋之心 蝴蝶精灵 花漫千山 中秋月圆 欢度国庆 雪花精灵 开卷有益 我书我心 甜心百灵 七夕之桥 樱果相依 前兔似锦
发表于 2024-5-22 13:58 | 显示全部楼层
谢谢分享啦!视听享受。
点评
回复

使用道具

*破姐小跟班*
两周年庆 巳巳如意 一叶知秋 版主勋章 音画同行 山高为峰 山外有山
发表于 2024-5-22 14:18 | 显示全部楼层
凡哥老师新作精彩
点评
回复

使用道具

您需要登录后才可以回帖 登录 | 中文注册

本版积分规则

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表