红影 发表于 2022-4-8 15:02

《春水》-班得瑞(学习多个水滴涟漪及旋转魔方)

<style>
/* 底图 */
.stage {
   top:120px;left:-302px;
   position: relative;
   width: 1200px;
   height: 765px;
   background: #FFF url('https://pic.imgdb.cn/item/624f115d239250f7c5b4e29b.jpg') no-repeat center/cover;
   box-shadow: 4px 4px 5px #888;
   border-radius:12px;
}
/* 涟漪 */
.lianyi {
   position: absolute;
   background: transparent;
   border: 1px solid #eee;
   border-radius: 50%;
   box-shadow: 0px 0px 6px #fff inset, 0 0 8px #000;
   position: absolute;

   opacity: 0;

}
.lianyi1 {
   width: 60px;
   height: 60px;
   left: 400px;
   top: 650px;
   animation: circle 1.8s 1.8s linear infinite;
}


.lianyi2 {
   width: 60px;
   height: 60px;
   left: 640px;
   top: 620px;
   animation: circle2 2.5s 2.5s linear infinite;
}
.lianyi3 {
   width: 60px;
   height: 60px;
   left: 840px;
   top: 662px;
   animation: circle3 2.0s 1.8s linear infinite;
}
/* 水滴 */
.wdrop {
   position: absolute;

   border-radius: 80% 0 55% 50% / 55% 0 80% 50%;
   transform: rotate(-45deg);
   background-image: linear-gradient(45deg, #8CA2FB 0%, #F0F0FD 100%);

}
.wdrop::after {
      content: '';
      width: 50%;
      height: 50%;
      position: absolute;
      left: 10%; top: 20%;
      border-radius: 50%;
      background: radial-gradient(circle at 50% 0px, #ffffff, rgba(255, 255, 255, 0) 58%);
      filter: blur(5px);
}
.wdrop1 {
   left: 420px;
   top: 260px;
   width: 20px;
   height: 20px;
   animation: drop 1.8s ease-in infinite;
}
.wdrop2 {
   left: 660px;
   top: 400px;
   width: 18px;
   height: 18px;
   animation: drop2 2.5s ease-in infinite;
}
.wdrop3 {
   left: 860px;
   top: 280px;
   width: 18px;
   height: 18px;
   animation: drop3 2.0s ease-in infinite;
}
/* 动画 */
@keyframes drop{
   0%      { top: 260px; }
   100%   { top: 650px; }
}
@keyframes circle {
   0%      { opacity: 0.1; }
   100%   { transform: scale(3, 1.2); opacity: 0; }
}
@keyframes drop2{
   0%      { top: 400px; }
   100%   { top: 620px; }
}
@keyframes circle2 {
   0%      { opacity: 0.1; }
   100%   { transform: scale(3, 1); opacity: 0; }
}
@keyframes drop3{
   0%      { top: 280px; }
   100%   { top: 662px; }
}
@keyframes circle3 {
   0%      { opacity: 0.1; }
   100%   { transform: scale(3, 1); opacity: 0; }
}
/* 音乐控制按钮 */
.picBtn {
       position: absolute;
       width: 100px;
       height: 100px;
       left: 100px;
       top: 580px;
       border: none;
       outline: none;
       border-radius: 8px;
       background: transparent url('https://pic.imgdb.cn/item/624fbfd5239250f7c5c20bdc.gif') no-repeat;
       cursor: pointer;
}
/* 旋转魔方 */
.cude {
      --xyz: 80px;
      --bb: -40px;
      width: var(--xyz);
      height: var(--xyz);
      position: absolute;
      left: 260px; top: 490px;
      transform-style: preserve-3d;
      transform: rotateX(-30deg) rotateY(-80deg);
      transform-origin: 50% 50% 0;
      animation: rot 10s linear infinite;
}
.pae {
      position: absolute;
      left: 0; top: 0;
      width: var(--xyz); height: var(--xyz);
      background: blue;
      opacity: .15;
      font: bold 40px / var(--xyz) Arial;
      color: #fff;
      text-align: center;
      text-shadow: 1px 1px 2px #000;
      border:1px solid #333;
}
.front { transform: rotateY(0) translateZ(calc(var(--xyz) / 2)); }
.back { transform: translateZ(var(--bb)) rotateY(180deg); }
.left { transform: rotateY(-90deg) translateZ(calc(var(--xyz) / 2)); }
.right { transform: rotateY(90deg) translateZ(calc(var(--xyz) / 2)); }
.top { transform: rotateX(90deg) translateZ(calc(var(--xyz) / 2)); }
.bottom { transform: rotateX(90deg) translateZ(var(--bb)); }

@-webkit-keyframes rot {
      from { transform: rotateX(0deg) rotateY(0deg); }
      to { transform: rotateX(360deg) rotateY(360deg); }
}
</style>

<div class="stage">
   <div class="wdrop wdrop1"></div><div class="lianyi lianyi1"></div>
   <div class="wdrop wdrop2"></div><div class="lianyi lianyi2"></div>
   <div class="wdrop wdrop3"></div><div class="lianyi lianyi3"></div>
      <div style="position: absolute; left:540px; top: 60px; width:650px;">
                <img alt="" src="https://pic.imgdb.cn/item/624f9886239250f7c55c810d.gif"/></div>
   <button id="picBtn" class="picBtn"></button>

<div class="cude">
      <div class="pae front">春</div>
      <div class="pae left">水</div>
      <div class="pae right">BY</div>
      <div class="pae bottom">班</div>
      <div class="pae top">得</div>
      <div class="pae back">瑞</div>
</div>
</div>
      <audio id="music" src="https://music.163.com/song/media/outer/url?id=1850157486.mp3" loop="loop"

autoplay="autoplay" ></audio>
</div><br><br><br><br><br>
<script language="javascript">

var mu = document.getElementById('music');
var btn = document.getElementById('picBtn');
btn.onclick = function(){
      mu.paused ? (mu.play(), btn.style.background="url('https://pic.imgdb.cn/item/624fbfd5239250f7c5c20bdc.gif')") :

(mu.pause(), btn.style.background="url('https://pic.imgdb.cn/item/624fc00f239250f7c5c29725.png')");
}
mu.addEventListener("ended", function(){
      btn.style.background="url('https://pic.imgdb.cn/item/624fc00f239250f7c5c29725.png')";
});
</script>

红影 发表于 2022-4-8 15:03

刚想发帖子时,正好看到黑黑的旋转魔方,也一并弄到帖子里来了。{:4_173:}

红影 发表于 2022-4-8 15:05

实在弄不来nth-child ,因为有水滴和涟漪两个要控制,我不知道怎样让一个nth-child干两件事,只能一个个设定,弄了3个水滴已经是我的极限,再多肯定位置要弄不清楚那些数据了{:4_173:}@马黑黑

梦油 发表于 2022-4-8 15:32

红影朋友下午好!看着美图,听着音乐,品着咖啡,嘿!美极了!

四海八荒 发表于 2022-4-8 16:56

喜欢班得瑞的音乐

加林森 发表于 2022-4-8 17:18

红影真厉害,一下就把老黑的教程给制作出来了,真漂亮。喜欢班得瑞的音乐。{:4_199:}

马黑黑 发表于 2022-4-8 18:13

东篱的魔方都用上了{:5_117:}

水滴先酱紫吧,能够自主多弄了两滴以及非常不错了

红影 发表于 2022-4-8 23:10

梦油 发表于 2022-4-8 15:32
红影朋友下午好!看着美图,听着音乐,品着咖啡,嘿!美极了!

谢谢梦油鼓励,我只是组合一下各种效果{:4_173:}

红影 发表于 2022-4-8 23:10

四海八荒 发表于 2022-4-8 16:56
喜欢班得瑞的音乐

是的,找了一圈,觉得这首还不错。

红影 发表于 2022-4-8 23:11

加林森 发表于 2022-4-8 17:18
红影真厉害,一下就把老黑的教程给制作出来了,真漂亮。喜欢班得瑞的音乐。

这个加到帖子里倒是不难,难的是那几滴水{:4_173:}

红影 发表于 2022-4-8 23:12

马黑黑 发表于 2022-4-8 18:13
东篱的魔方都用上了

水滴先酱紫吧,能够自主多弄了两滴以及非常不错了

这个是做的最费劲的帖子,要是光是水滴方便很多了,主要还要考虑涟漪{:4_173:}

马黑黑 发表于 2022-4-8 23:18

红影 发表于 2022-4-8 23:12
这个是做的最费劲的帖子,要是光是水滴方便很多了,主要还要考虑涟漪

现在应该能理解程序设计的重要了

加林森 发表于 2022-4-8 23:27

红影 发表于 2022-4-8 23:11
这个加到帖子里倒是不难,难的是那几滴水

明白的,辛苦了。{:4_204:}

樵歌 发表于 2022-4-9 08:47

活学活用,越学越精了,真漂亮呵{:4_178:}

梦油 发表于 2022-4-9 09:37

红影 发表于 2022-4-8 23:10
谢谢梦油鼓励,我只是组合一下各种效果

好啊,多才多艺。

红影 发表于 2022-4-9 10:19

马黑黑 发表于 2022-4-8 23:18
现在应该能理解程序设计的重要了

是的,把计算部分交给电脑,会省力很多,而且不会出现人工失误。

红影 发表于 2022-4-9 10:20

加林森 发表于 2022-4-8 23:27
明白的,辛苦了。

那个去配套着调好麻烦的{:4_173:}

红影 发表于 2022-4-9 10:20

樵歌 发表于 2022-4-9 08:47
活学活用,越学越精了,真漂亮呵

师兄咋还不开始学啊,猫猫本来也不会,不也学出来了{:4_173:}

马黑黑 发表于 2022-4-9 10:21

红影 发表于 2022-4-9 10:19
是的,把计算部分交给电脑,会省力很多,而且不会出现人工失误。

理解正确

红影 发表于 2022-4-9 10:22

梦油 发表于 2022-4-9 09:37
好啊,多才多艺。

学习这些还是很好玩的{:4_173:}
页: [1] 2 3
查看完整版本: 《春水》-班得瑞(学习多个水滴涟漪及旋转魔方)