楼主: 凡哥

[碎语] 源码小屋

[复制链接]
发表于 2024-10-2 18:08 | 显示全部楼层
凡哥 发表于 2024-10-2 18:01
纯手写的,JS没有参与写svg


这个对小白比较友好。数学不好,碰上计算的就傻眼了
点评
回复

使用道具

 楼主| 发表于 2024-10-2 21:08 | 显示全部楼层
花简静 发表于 2024-10-2 18:08
这个对小白比较友好。数学不好,碰上计算的就傻眼了

其实也就是数学问题,初中水平可解
点评
回复

使用道具

发表于 2024-10-2 23:39 | 显示全部楼层
凡哥 发表于 2024-10-2 21:08
其实也就是数学问题,初中水平可解

这初中水平也太高级了吧。。高初。大初。
点评
回复

使用道具

 楼主| 发表于 2024-10-3 08:01 | 显示全部楼层
花简静 发表于 2024-10-2 23:39
这初中水平也太高级了吧。。高初。大初。

点评
回复

使用道具

 楼主| 发表于 2024-10-3 08:10 | 显示全部楼层
本帖最后由 凡哥 于 2024-10-3 08:11 编辑

2024年10月3日 星期四

Angel Warrior

<style>
	#dbox { margin: 30px 0 30px calc(50% - 513px); width: 1024px; height: 640px; background: radial-gradient(transparent 70%,transparent,rgba(0,0,128,.6)), url('https://638183.freep.cn/638183/t24/webp2/angelwarrior.webp') no-repeat center/cover; box-shadow: 4px 4px 16px #00000080; z-index: 1; position: relative; }
	#msvg { position: absolute; right: 100px; bottom: 100px; }
	#cpath { cursor: pointer; filter: drop-shadow(0 0 4px #000); transform-origin: 50%; animation: rot 6s linear infinite var(--state), chgcolor 12s linear infinite alternate var(--state); }
	#vid { position: absolute; width: 100%; height: 100%; object-fit: cover; -webkit-mask: radial-gradient(green, transparent, transparent); }
	@keyframes rot { to { transform: rotate(360deg); stroke-dashoffset: -160; } }
	@keyframes chgcolor { to { fill: rgba(65,105,225,.5); } }
</style>

<div id="dbox">
	<audio id="aud" src="https://music.163.com/song/media/outer/url?id=36871349" autoplay loop></audio>
	<video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/02/34/5b5921021d972.mp4" autoplay loop muted></video>
	<svg id="msvg" width="200" height="200">
		<defs>
			<g id="cpath"  fill="rgba(65,105,225,.1)" stroke="rgba(255,255,255,.7)" stroke-width="4" stroke-dasharray="4">
				<path d='M100 120 C10 -30,190 -30,100 120'/>
			</g>
		</defs>
	</svg>
</div>

<script>
	mState = () => {
		dbox.style.setProperty('--state', aud.paused ? 'paused' : 'running');
		aud.paused ? (msvg.pauseAnimations(), vid.pause()) : (msvg.unpauseAnimations(), vid.play());
	}
	mkLeaves = (total) => {
		let str = '';
		Array(total).fill().forEach((_,idx) => {
			str += `<use href="#cpath" transform="rotate(${360 / total * idx} 100 100)"/>`;
		});
		return str;
	};
	msvg.innerHTML += mkLeaves(5);
	aud.onplaying = aud.onpause = () => mState();
	msvg.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>

评分

1

查看全部评分

点评
回复

使用道具

发表于 2024-10-3 10:40 | 显示全部楼层

老斗鸡眼,怎么学好数学的。。
点评
回复

使用道具

发表于 2024-10-3 10:41 | 显示全部楼层
凡哥 发表于 2024-10-3 08:10
本帖最后由 凡哥 于 2024-10-3 08:11 编辑 2024年10月3日 星期四
Angel Warrior

背景给个径向渐变,视频也整个径向渐变,两个还同色系,细节整得也好,怪好看的
点评
回复

使用道具

 楼主| 发表于 2024-10-5 19:55 | 显示全部楼层
花简静 发表于 2024-10-3 10:41
背景给个径向渐变,视频也整个径向渐变,两个还同色系,细节整得也好,怪好看的 ...

谢看
点评
回复

使用道具

 楼主| 发表于 2024-10-5 19:56 | 显示全部楼层
花简静 发表于 2024-10-3 10:40
老斗鸡眼,怎么学好数学的。。


斗鸡眼的数学都好
点评
回复

使用道具

 楼主| 发表于 2024-10-5 20:03 | 显示全部楼层

2024年10月5日 星期六

The Promise

<style>
	#papa { margin: 30px 0 30px calc(50% - 602px); width: 1024px; height: 640px; background: url('https://638183.freep.cn/638183/t24/4/promise.jpg') no-repeat center/cover; box-shadow: 4px 4px 8px gray; z-index: 1; position: relative; }
	#player { position: absolute; bottom: 10px; left: calc(50% - 100px); width: 200px; height: 200px; cursor: pointer; animation: rot 8s linear infinite var(--state); }
	#vid { position: absolute; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: screen; -webkit-mask: linear-gradient(transparent 10%, red 30%, red 0); pointer-events: none; }
	@keyframes rot { to { transform: rotate(360deg); } }
</style>

<div id="papa">
	<audio id="aud" src="https://music.163.com/song/media/outer/url?id=410055747" autoplay loop></audio>
	<video id="vid" src="https://img.tukuppt.com/video_show/15653652/01/41/56/6332b7166860f.mp4" autoplay loop muted></video>
	<img id="player" alt="" src="https://638183.freep.cn/638183/web/svg/9star.svg"/>
</div>

<script>
	mState = () => {
		papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
		aud.paused ? vid.pause() : vid.play();
	};
	aud.onplaying = aud.onpause = () => mState();
	player.onclick = () => aud.paused ? aud.play() : aud.pause();
</script>

评分

1

查看全部评分

点评
回复

使用道具

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

本版积分规则

手机版|千山论坛 ( 冀ICP备2024055714号 )

GMT+8, 2025-9-15 19:14

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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