【黑师代码】心中的歌(学习黑师20240628《魂引》小播碰撞接力运动效果)
<style>
#mydiv { --width: 1700px; margin: 130px 0 30px calc(50% - (var(--width) / 2 + 81px)); width: var(--width); height: 900px; background: #eee url('https://642303.freep.cn/642303/tu/yangguang04.webp') no-repeat center/cover; box-shadow: 2px 2px 8px rgba(0,0,0,.7); overflow: hidden; z-index: 1; position: relative;}
.ball { position: absolute; width: 120px; height: 120px; background: url('https://642303.freep.cn/642303/za/shuijing300.png') no-repeat 50%/96%; border-radius: 50%; opacity: .95; transition: width .5s, height .5s, opacity .5s; cursor: pointer; offset-path: path('M880 60 Q1940 360,720 820'); offset-distance: 0; animation: 6s linear forwards;}
.ball:hover { width: 45px; height: 45px; opacity: .75; }
.ball:nth-of-type(1) { left: -20px; top: 0; animation-name: move1-1;mix-blend-mode: sereen;opacity: .55;}
.ball:nth-of-type(2) { left: -15px; top: 0; width: 280px; height: 280px;background: url('https://642303.freep.cn/642303/za/38477af75a9245ae9a27fb2a3fb33efa_tplv-obj_500_500.gif') no-repeat 50%/96%; offset-distance: 50%;mix-blend-mode: screen;}
#vid { position: absolute; width: 100%; height: 110%; top:-80px; object-fit: cover; mix-blend-mode: screen; pointer-events: none; opacity: .65;}
@keyframes move1-1 {
from { offset-distance: 0%; transform: rotate(720deg); filter: hue-rotate(0); }
to { offset-distance: 50%; transform: rotate(0); filter: hue-rotate(360deg); }
}
@keyframes move1-2 {
from { offset-distance: 50%; transform: rotate(0); filter: hue-rotate(360deg); }
to { offset-distance: 0%; transform: rotate(720deg); filter: hue-rotate(0); }
}
@keyframes move2-1 {
from { offset-distance: 50%; transform: rotate(720deg); filter: hue-rotate(0deg); }
to { offset-distance: 100%; transform: rotate(0); filter: hue-rotate(360deg); }
}
@keyframes move2-2 {
from { offset-distance: 100%; transform: rotate(0); filter: hue-rotate(360deg); }
to { offset-distance: 50%; transform: rotate(720deg); filter: hue-rotate(0); }
}
</style>
<div id="mydiv">
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=2103389092" autoplay loop></audio>
<video id="vid" src="https://img.tukuppt.com/video_show/2269348/00/14/92/5e67b21fa8e26.mp4" autoplay loop muted></video>
<div id="b1" class="ball"></div>
<div id="b2" class="ball"></div>
</div>
<script>
const balls = ;
b1.onanimationend = ()=> {
let ani = window.getComputedStyle(b1).getPropertyValue('animation-name');
if(ani === 'move1-1') {
b1.style.animationName = '';
b2.style.animationName = 'move2-1';
}else{
b1.style.animationName = 'move1-1';
}
};
b2.onanimationend = () => {
let ani = window.getComputedStyle(b2).getPropertyValue('animation-name');
if(ani === 'move2-1') {
b2.style.animationName = 'move2-2';
}else{
b2.style.animationName = '';
b1.style.animationName = 'move1-2';
}
};
var mState = () => {
balls.forEach(b => {
b.style.animationPlayState = aud.paused ? 'paused' : 'running';
b.title = ['暂停','播放'][+aud.paused];
});
aud.paused ? vid.pause() : vid.play();
};
aud.oncanplay = aud.onplaying = aud.onpause = () => mState();
balls.forEach(b => b.onclick = () => aud.paused ? aud.play() : aud.pause());
var sF = document.createElement('script');
sF.src = 'https://638183.freep.cn/638183/web/api/fullscreen.js';
sF.charset = 'utf-8';
document.querySelector('body').appendChild(sF);
sF.onload = () => FS({
papa: '#mydiv',
css: 'bottom: -100px; left: 50%; transform: translate(-50%); --color: snow; --fsBg: transparent;',
});
window.onresize = () => balls.forEach(b => {
b.style.offsetPath = `path('M880 60 Q${mydiv.offsetWidth+ 240} ${mydiv.offsetHeight / 2 - 40}, ${mydiv.offsetWidth - 1080} 880')`;
b.style.animationDuration = ((mydiv.offsetWidth + mydiv.offsetHeight) / (1700 + 900)) * 6 + 's';
});
</script>
@马黑黑 白老师来瞧一瞧,交一份作业。。{:4_173:} 欣赏佳作,问候南无月。 这个设计漂亮,更换了小球,仿佛置换了灵魂一样,很奇妙的图形。还换了小球为垂直移动方向。
很赞的制作。欣赏月儿好帖{:4_199:} 脑袋瓜子真是灵慧,新创意层出不穷呵。 梦油 发表于 2024-6-29 17:30
欣赏佳作,问候南无月。
问好,感谢临贴支持{:4_190:} 红影 发表于 2024-6-29 17:35
这个设计漂亮,更换了小球,仿佛置换了灵魂一样,很奇妙的图形。还换了小球为垂直移动方向。
很赞的制作。 ...
谢谢影子鼓励~~昨天做的的横移有点挡字,今天又改竖的~~{:4_187:} 樵歌 发表于 2024-6-29 17:50
脑袋瓜子真是灵慧,新创意层出不穷呵。
{:4_190:}谢谢樵管支持鼓励 南无月 发表于 2024-6-29 17:15
@马黑黑 白老师来瞧一瞧,交一份作业。。
{:4_174:} 路径的设计有自己的理念在里面,运动元素的创意也是无比高端!大赞! 目光所致,皆是精品{:4_199:} 马黑黑 发表于 2024-6-29 18:25
巴适得板。。周末过得好休闲啊{:4_173:} 马黑黑 发表于 2024-6-29 18:26
路径的设计有自己的理念在里面,运动元素的创意也是无比高端!大赞!
路径更改是为了不跟原来的排字挤成一团
右边比较空就试着放过来
运动元素手边有这些好玩的图用上
这两个小球一个left20一个left-20,碰了就开
后来就整了一大一小,没让它们碰,而是重叠在一起的。。。 小九 发表于 2024-6-29 18:42
目光所致,皆是精品
哇,小九这评价老高了,开心ING.。。{:4_170:} 南无月 发表于 2024-6-29 18:46
路径更改是为了不跟原来的排字挤成一团
右边比较空就试着放过来
运动元素手边有这些好玩的图用上
都行的 南无月 发表于 2024-6-29 18:43
巴适得板。。周末过得好休闲啊
有点忙 马黑黑 发表于 2024-6-29 18:59
都行的
{:4_181:}那以后可以继续魔改了 马黑黑 发表于 2024-6-29 19:00
有点忙
周末休闲时间忙得开心就好{:4_170:} 月月的图越做越漂亮了,看点多多的美图,棒棒哒{:4_187:} 问好月月,周末快乐{:4_187:}