一个人的龟兹
<style>#tz { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); min-height: 80vh; aspect-ratio: 16/9; background: #eee url('https://638183.freep.cn/638183/t24/webp3/qqci.webp') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
#player { position: absolute; width: 15vw; height: auto; aspect-ratio: 1/1; cursor: pointer; background: none; border-radius: 50%; transform: translateX(-20px); }
#btnFs { bottom: 20px; color: #eee; text-align: center; }
#btnFs:hover { color: red; }
#vid {position: absolute; width: 100%; height: 100%; object-fit: cover; mask: radial-gradient(transparent 20%, red); -webkit-mask: radial-gradient(transparent 20%, red); pointer-events: none; }
</style>
<div id="tz">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=75380" autoplay loop></audio>
<video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/23/09/15/19/16/59/video65043d2b7691a.mp4" autoplay loop muted></video>
<div id="player" title="播放/暂停"></div>
</div>
<script type="importmap">
{
"imports": {
"three": "https://638183.freep.cn/638183/3dev/build/three.module.min.js",
"three/addons/": "https://638183.freep.cn/638183/3dev/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js';
import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
const scene = new THREE.Scene();
const clock = new THREE.Clock();
const camera = new THREE.PerspectiveCamera(60, tz.offsetWidth / tz.offsetHeight, 1, 1000);
camera.position.set(0, 0, 5);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(tz.offsetWidth, tz.offsetHeight);
tz.appendChild(renderer.domElement);
const texture = new THREE.TextureLoader().load('https://638183.freep.cn/638183/small/gt100.jpg');
texture.colorSpace = THREE.SRGBColorSpace;
const box = new THREE.Mesh(
new THREE.BoxGeometry(),
new THREE.MeshBasicMaterial({ map: texture })
);
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(0.8, 1, 1, 16, 1),
new THREE.MeshBasicMaterial({ wireframe: true })
);
mesh.add(box);
mesh.position.set(-0.15, 0, 0);
scene.add(mesh);
const composer = new EffectComposer(renderer);
const renderPass = new RenderPass(scene, camera);
composer.addPass(renderPass);
const outlinePass = new OutlinePass(new THREE.Vector2(tz.offsetWidth, tz.offsetHeight), scene, camera);
outlinePass.visibleEdgeColor.set(0xffff88);
outlinePass.edgeThickness = 8;
outlinePass.edgeStrength = 10;
outlinePass.pulsePeriod = 0.5;
outlinePass.selectedObjects = ;
composer.addPass(outlinePass);
const animate = (currentTime) => {
const delta = clock.getDelta();
mesh.rotation.y -= delta / 5;
composer.render();
requestAnimationFrame(animate);
};
aud.onplaying = aud.onpause = () => aud.paused ? (clock.stop(), outlinePass.pulsePeriod = 0) : (clock.start(), outlinePass.pulsePeriod = 0.5);
animate();
FS(tz, player);
</script> 帖子代码
<style>
#tz { margin: 30px 0; left: calc(50% - 81px); transform: translateX(-50%); width: clamp(600px, 90vw, 1400px); min-height: 80vh; aspect-ratio: 16/9; background: #eee url('https://638183.freep.cn/638183/t24/webp3/qqci.webp') no-repeat center/cover; box-shadow: 2px 2px 8px #000; display: grid; place-items: center; z-index: 1; position: relative; }
#player { position: absolute; width: 15vw; height: auto; aspect-ratio: 1/1; cursor: pointer; background: none; border-radius: 50%; transform: translateX(-20px); }
#btnFs { bottom: 20px; color: #eee; text-align: center; }
#btnFs:hover { color: red; }
#vid {position: absolute; width: 100%; height: 100%; object-fit: cover; mask: radial-gradient(transparent 20%, red); -webkit-mask: radial-gradient(transparent 20%, red); pointer-events: none; }
</style>
<div id="tz">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=75380" autoplay loop></audio>
<video id="vid" src="https://bpic.588ku.com/video_listen/588ku_video/23/09/15/19/16/59/video65043d2b7691a.mp4" autoplay loop muted></video>
<div id="player" title="播放/暂停"></div>
</div>
<script type="importmap">
{
"imports": {
"three": "https://638183.freep.cn/638183/3dev/build/three.module.min.js",
"three/addons/": "https://638183.freep.cn/638183/3dev/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js';
import { FS } from 'https://638183.freep.cn/638183/web/ku/FS.js';
const scene = new THREE.Scene();
const clock = new THREE.Clock();
const camera = new THREE.PerspectiveCamera(60, tz.offsetWidth / tz.offsetHeight, 1, 1000);
camera.position.set(0, 0, 5);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(tz.offsetWidth, tz.offsetHeight);
tz.appendChild(renderer.domElement);
const texture = new THREE.TextureLoader().load('https://638183.freep.cn/638183/small/gt100.jpg');
texture.colorSpace = THREE.SRGBColorSpace;
const box = new THREE.Mesh(
new THREE.BoxGeometry(),
new THREE.MeshBasicMaterial({ map: texture })
);
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(0.8, 1, 1, 16, 1),
new THREE.MeshBasicMaterial({ wireframe: true })
);
mesh.add(box);
mesh.position.set(-0.15, 0, 0);
scene.add(mesh);
const composer = new EffectComposer(renderer);
const renderPass = new RenderPass(scene, camera);
composer.addPass(renderPass);
const outlinePass = new OutlinePass(new THREE.Vector2(tz.offsetWidth, tz.offsetHeight), scene, camera);
outlinePass.visibleEdgeColor.set(0xffff88);
outlinePass.edgeThickness = 8;
outlinePass.edgeStrength = 10;
outlinePass.pulsePeriod = 0.5;
outlinePass.selectedObjects = ;
composer.addPass(outlinePass);
const animate = (currentTime) => {
const delta = clock.getDelta();
mesh.rotation.y -= delta / 5;
composer.render();
requestAnimationFrame(animate);
};
aud.onplaying = aud.onpause = () => aud.paused ? (clock.stop(), outlinePass.pulsePeriod = 0) : (clock.start(), outlinePass.pulsePeriod = 0.5);
animate();
FS(tz, player);
</script>
龟兹(qiu1 ci2),又称丘慈、邱兹、丘兹,中国古代西域大国之一,汉朝时为西域北道诸国之一,唐代安西四镇之一。为古来西域出产铁器之地。
本帖,使用 ThreeJS 后期处理加入了图像的轮廓高亮描边效果。所谓后期处理,指图像(可能包含动画)绘制好之后,再合成其它的效果。ThreeJS自带一些后期处理扩展库,有得很简单,有得很复杂,像这个轮廓描边属于复杂的一类。更多后期处理的相关知识如果大家感兴趣,可以考虑开帖说明。 本帖所使用的 ThreeJS 资源是我部署在网盘的静态资源,导入资源的速度有保障,未来五年内保证有效(除非运营商倒闭或其它政策性问题导致其关闭) 马黑黑 发表于 2025-6-5 20:23
龟兹(qiu1 ci2),又称丘慈、邱兹、丘兹,中国古代西域大国之一,汉朝时为西域北道诸国之一,唐代安西四镇 ...
这个是把两个图像套起来了,还带贴图的,真漂亮。
这个图像轮廓高亮描边的效果也很奇妙,还是头一次见呢{:4_199:} 马黑黑 发表于 2025-6-5 20:27
本帖所使用的 ThreeJS 资源是我部署在网盘的静态资源,导入资源的速度有保障,未来五年内保证有效(除非运 ...
黑黑辛苦了,还提供这么强大的保证,给黑黑点赞{:4_187:} 马黑黑 发表于 2025-6-5 20:23
龟兹(qiu1 ci2),又称丘慈、邱兹、丘兹,中国古代西域大国之一,汉朝时为西域北道诸国之一,唐代安西四镇 ...
“ThreeJS自带一些后期处理扩展库,”黑黑能讲解一下当然最好了,又可以混个脸熟了,只是太辛苦黑黑了{:4_187:} 这音乐很玄妙,视频也用得好,那些飘逸的曲线很好地呼应了帖子呢{:4_199:} 红影 发表于 2025-6-5 21:10
这音乐很玄妙,视频也用得好,那些飘逸的曲线很好地呼应了帖子呢
谢好 红影 发表于 2025-6-5 21:08
“ThreeJS自带一些后期处理扩展库,”黑黑能讲解一下当然最好了,又可以混个脸熟了,只是太辛苦黑黑了{:4 ...
不过这个先得弄通前期制作,否则讨论后期处理也没意思 红影 发表于 2025-6-5 21:06
黑黑辛苦了,还提供这么强大的保证,给黑黑点赞
个人层面是没问题的 马黑黑 发表于 2025-6-5 20:23
龟兹(qiu1 ci2),又称丘慈、邱兹、丘兹,中国古代西域大国之一,汉朝时为西域北道诸国之一,唐代安西四镇 ...
原来轮廓描边是另外的扩展库,不是封在里面的呀。。
从今天这个描边效果看,特别显眼。。
看来库里有不少宝贝,期待开贴说明,很感兴趣。。{:4_173:}
先举手了哈 红影 发表于 2025-6-5 21:02
这个是把两个图像套起来了,还带贴图的,真漂亮。
这个图像轮廓高亮描边的效果也很奇妙,还是头一次见呢 ...
这个描边,可设置的参数很多很多,当然也可以使用默认的或使用几个较为有用的参数 花飞飞 发表于 2025-6-5 21:38
原来轮廓描边是另外的扩展库,不是封在里面的呀。。
从今天这个描边效果看,特别显眼。。
看来库里有不 ...
前期制作回了木有?比如画一个球,一个立方体。 马黑黑 发表于 2025-6-5 20:23
龟兹(qiu1 ci2),又称丘慈、邱兹、丘兹,中国古代西域大国之一,汉朝时为西域北道诸国之一,唐代安西四镇 ...
挺安静的音乐,里面有铃音贯穿始终,适合细细聆听,慢慢品味,有禅意{:4_173:} 马黑黑 发表于 2025-6-5 20:27
本帖所使用的 ThreeJS 资源是我部署在网盘的静态资源,导入资源的速度有保障,未来五年内保证有效(除非运 ...
JS资源移入自己网盘,不再用外域的吧,速度很快。。。比视频还快{:4_173:}
但愿它长久存在 花飞飞 发表于 2025-6-5 21:44
JS资源移入自己网盘,不再用外域的吧,速度很快。。。比视频还快
但愿它长久存在
那个境内的CDN速度也不错的 花飞飞 发表于 2025-6-5 21:42
挺安静的音乐,里面有铃音贯穿始终,适合细细聆听,慢慢品味,有禅意
禅意不一定有,这是怀古思绪,有思念,但不见得有佛的东东 中间是个立方体几何体,贴了一张图,四面显示。。
外部套了个圆柱体,居然整成了上窄下宽的样式,也好看
两个简单几何体双层套用,比较有层次感,画面显得更丰富。 谢谢老师经典分享,期待老师开贴讲授ThreeJS 后期处理的基础知识与方法技巧{:4_191:}