封面 《Clover Day’s》
前言
因为对 butterfly 改了很多次,所以记录一下自己的修改记录,以免后面再次修改的时候找不到修改的地方,同时方便后续删除魔改。
魔改记录
在右边的目录可以方便查询
跳动标题
添加 shake-it.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #site-title:hover, #post-title:hover, .article-title:hover { animation: shake-it 0.5s reverse infinite cubic-bezier(0.68, -0.55, 0.27, 1.55); } @keyframes shake-it { 0% { text-shadow: 0 0 rgba(0, 255, 255, 0.5), 0 0 rgba(255, 0, 0, 0.5); } 25% { text-shadow: -2px 0 rgba(0, 255, 255, 0.5), 2px 0 rgba(255, 0, 0, 0.5); } 50% { text-shadow: -5px 0 rgba(0, 255, 255, 0.5), 3px 0 rgba(255, 0, 0, 0.5); } 100% { text-shadow: 3px 0 rgba(0, 255, 255, 0.5), 5px 0 rgba(255, 0, 0, 0.5); } }
|
在_config.butterfly.yml
中注入代码添加 shake-it.css
1 2 3
| inject: head: + - <link rel="stylesheet" href="/css/shake-it.css"/>
|
效果如下
live2d 组件
在_config.butterfly.yml
中注入代码添加 autoload.js
1 2 3
| inject: head: + - <script src="https://cdn-js.moeworld.top/gh/qxdn/[email protected]/autoload.js"></script>
|
其中对 live2d 的配置在 https://github.com/qxdn/live2d-widget
,live2d 的模型在 https://github.com/qxdn/live2d_api
。
效果
天气组件
创建 weather-widget.js
,其中配置在心知天气添加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| const menus = document.getElementById("menus"); menus.insertAdjacentHTML("beforebegin", `<div id="tp-weather-widget"></div>`); (function (a, h, g, f, e, d, c, b) { b = function () { d = h.createElement(g); c = h.getElementsByTagName(g)[0]; d.src = e; d.charset = "utf-8"; d.async = 1; c.parentNode.insertBefore(d, c); }; a["SeniverseWeatherWidgetObject"] = f; a[f] || (a[f] = function () { (a[f].q = a[f].q || []).push(arguments); }); a[f].l = +new Date(); if (a.attachEvent) { a.attachEvent("onload", b); } else { a.addEventListener("load", b, false); } })( window, document, "script", "SeniverseWeatherWidget", "//cdn.sencdn.com/widget2/static/js/bundle.js?t=" + parseInt((new Date().getTime() / 100000000).toString(), 10) ); window.SeniverseWeatherWidget("show", { flavor: "slim", location: "", geolocation: true, language: "auto", unit: "c", theme: "auto", token: "", hover: "enabled", container: "tp-weather-widget", });
|
效果
github 日历
安装依赖
1
| npm install --save @barry-flynn/hexo-github-calendar
|
在_config.yml
中注入代码添加配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| githubcalendar: enable: true priority: 12 enable_page: / user: qxdn layout: type: id name: recent-posts index: 0 githubcalendar_html: '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>' pc_minheight: 280px mobile_minheight: 0px color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']" api: https://calendar.qianxu.run/api calendar_js: https://cdn-js.moeworld.top/gh/Barry-Flynn/[email protected]/hexo_githubcalendar.js plus_style: ""
|
效果
文章轮播
安装依赖
1
| npm install hexo-butterfly-swiper --save
|
在_config.butterfly.yml
中注入代码添加配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
swiper: enable: true priority: 5 enable_page: / timemode: date layout: type: id name: recent-posts index: 0 default_descr: 再怎么看我也不知道怎么描述它的啦! swiper_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css swiper_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js custom_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css custom_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js
|
效果
AI 摘要
创建 ai-summary.js
,其中 key 在爱发电购买,后台管理在 https://postsummary.zhheo.com/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| new ChucklePostAI({ el: "#post>#article-container", key: "", rec_method: "web", hide_shuttle: true, summary_directly: true, pjax: true, summary_speech: true, interface: { name: "AI摘要", introduce: "我是文章辅助AI: 点击下方的按钮,让我生成本文简介、推荐相关文章等。", }, });
|
在_config.butterfly.yml
中注入代码添加配置
1 2 3 4 5
| inject: head: + - <script src="https://jsd.onmicrosoft.cn/gh/qxchuckle/[email protected]/chuckle-post-ai.min.js"></script> bottom: + - <script src="/scripts/ai-summary.js" data-pjax defer />
|
效果
bilibili 视频适配
创建 bilibili.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| .aspect-ratio { position: relative; width: 100%; height: 0; padding-bottom: 75%; margin: 3% auto; text-align: center; } .aspect-ratio iframe { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
|
效果
人生倒计时
在_data
中创建 widget.yml
,添加如下内容
1 2 3 4 5 6
| top: - class_name: aside aside-count name: 人生倒计时 icon: fas fa-hourglass-half order: 5 html: <div id="life-progress" ></div> <script src="https://cdn-js.moeworld.top/gh/qxdn/life-progress@latest/autoload.min.js"></script>
|
效果
pixiv 日榜
在_data/widget.yml
,添加如下内容
1 2 3 4
| bottom: + - name: pixiv 日榜Top50 + html: '<iframe src="https://pixiv.mokeyjay.com" style="width:240px; height:380px; border: 0"></iframe>' + order: 3
|
效果
访客地图
在_data/widget.yml
,添加如下内容。其中 html 组件到 https://www.revolvermaps.com/?target=gallery 获取。
1 2 3 4 5
| bottom: + - name: 访客来源 + icon: fas fa-globe-asia fa-spin + order: 5 + html: <script type="text/javascript" async="async"></script>
|
效果
信封留言板
安装依赖
1
| npm install --save hexo-butterfly-envelope
|
在_config.butterfly.yml
中注入代码添加配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
envelope_comment: enable: true custom_pic: cover: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/violet.jpg line: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/line.png beforeimg: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/before.png afterimg: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/after.png message: - 有什么想问的? - 有什么想说的? - 有什么想吐槽的? - 哪怕是有什么想吃的,都可以告诉我哦~ bottom: 自动书记人偶竭诚为您服务! height: path: front_matter: title: 留言板 comments: true
|
效果
朋友圈
创建朋友圈页
在 /fcircle/index.md
中添加如下内容,其中后端 api 的配置见 https://fcircle-doc.yyyzyyyz.cn/#/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <div id="hexo-circle-of-friends-root"></div> <script> let UserConfig = { // 填写你的api地址 private_api_url: 'https://fcircle.qianxu.run/', // 初始加载几篇文章 page_init_number: 20, // 点击加载更多时,一次最多加载几篇文章,默认10 page_turning_number: 10, // 头像加载失败时,默认头像地址 error_img: 'https://sdn.geekzu.org/avatar/57d8260dfb55501c37dde588e7c3852c', // 进入页面时第一次的排序规则 sort_rule: 'created', // 本地文章缓存数据过期时间(天) expire_days: 1, } </script> <script type="text/javascript" src="https://npm.elemecdn.com/[email protected]/dist/fcircle.min.js"></script>
|
效果
音乐页
安装依赖
1
| npm install --save hexo-anzhiyu-music
|
创建音乐页
创建 music.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
| body:has(#anMusic-page) .layout.hide-aside { max-width: 85%; }
#page:has(#anMusic-page) { border: 0; box-shadow: none !important; padding: 0 !important; background: transparent !important; } body:has(#anMusic-page) .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap { bottom: 0; right: -5px; } #page:has(#anMusic-page) h1.page-title { display: none; } [data-theme="dark"] #page:has(#anMusic-page) #article-container .aplayer { filter: none; } [data-theme="dark"] .page:has(#anMusic-page) { background: linear-gradient(to bottom, rgb(0 0 0 / 80%), rgb(0 0 0 / 0%)); } #an_music_bg { display: none; filter: blur(63px); opacity: 0.6; position: fixed; z-index: -999; background-attachment: local; background-position: center center; background-size: cover; background-repeat: no-repeat; width: 200%; height: 200%; top: -50%; left: -50%; transform: rotate(0deg); transition: 0.3s; } body:has(#anMusic-page) { background-color: #0d0d0d; } body:has(#anMusic-page) #an_music_bg { display: block; } body:has(#anMusic-page) #web_bg { display: none; } body:has(#anMusic-page) .s-sticker div { color: #fff !important; } body:has(#anMusic-page) .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon.aplayer-icon-loop { margin-right: 15px; } #anMusic-page meting-js .aplayer { display: flex; flex-direction: row-reverse; background: rgba(0, 0, 0, 0); border: none; box-shadow: none; } #anMusic-page meting-js .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar { height: 6px; border-radius: 4px; } #anMusic-page meting-js .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-played { height: 6px; border-radius: 4px; } #anMusic-page meting-js .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-played .aplayer-thumb { width: 20px; height: 20px; margin-top: -7px; } #anMusic-page meting-js .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-loaded { height: 6px; border-radius: 4px; } #anMusic-page .aplayer-body { width: 60%; height: 75vh; } #anMusic-page ol { max-height: 75vh !important; padding-right: 25px; } #anMusic-page ol > li { border-top: 1px solid transparent; font-size: 14px; } #anMusic-page ol > li:hover { background: rgba(255, 255, 255, 0.2); border-radius: 6px; } #anMusic-page ol > li.aplayer-list-light { background: rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 20px 15px; } #anMusic-page ol > li.aplayer-list-light span.aplayer-list-title { font-weight: bolder; } #anMusic-page ol > li.aplayer-list-light .aplayer-list-cur { display: none; } #anMusic-page ol > li span { color: #fff; } #anMusic-page ol > li span.aplayer-list-author { opacity: 0.6; } #anMusic-page .aplayer-pic { float: none; width: 180px; height: 180px; border-radius: 12px; margin: auto; left: 0; right: 0; transition: background-image 0.5s ease-in-out; background-size: cover; background-color: transparent !important; } #anMusic-page .aplayer-info { margin: 0 20px 0 20px; border-bottom: none; } #anMusic-page .aplayer-info .aplayer-music { text-align: center; height: auto; margin: 15px; } #anMusic-page .aplayer-info .aplayer-lrc { height: 800%; margin-top: 80px; mask-image: linear-gradient( to bottom, #000, #000, #000, #000, #000, #000, #000, #000, #000, #000, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) ); } #anMusic-page .aplayer-info .aplayer-lrc p { font-size: 20px; line-height: 20px !important; height: 20px !important; margin: 20px 0 !important; color: #fff; } #anMusic-page .aplayer-info .aplayer-controller { position: fixed; max-width: 1500px; margin: auto; left: 0; right: 0; bottom: 50px; } #anMusic-page .aplayer-info .aplayer-controller .aplayer-bar-wrap { margin: 0 160px 0 150px; } #anMusic-page .aplayer-info .aplayer-controller .aplayer-played { background: #fff !important; } #anMusic-page .aplayer-info .aplayer-controller .aplayer-thumb { -webkit-transform: none; transform: none; background: #fff !important; } #anMusic-page .aplayer-info .aplayer-time { position: absolute; width: 100%; bottom: 21px; height: 0; display: flex; justify-content: flex-end; } #anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner { margin-right: 18px; margin-top: -8px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back { position: absolute; left: 0; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play { position: absolute; left: 40px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward { position: absolute; left: 80px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon { width: 2rem; height: 2rem; margin-left: 15px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon path { fill: #fff; opacity: 0.8; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-menu { display: none; } #anMusic-page .aplayer-list { width: 40%; max-height: none !important; height: 100%; } body:has(#anMusic-page) #footer, body:has(#anMusic-page) #nav-music { display: none; } #anMusic-page .aplayer-info .aplayer-music .aplayer-author, #anMusic-page .aplayer-info .aplayer-music .aplayer-title { font-size: 2rem; font-weight: 700; color: #fff; } #anMusic-page .aplayer .aplayer-lrc:after, #anMusic-page .aplayer .aplayer-lrc:before { display: none; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back, #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward, #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play { display: inline; } .page:has(#anMusic-page) #nav { backdrop-filter: none !important; background: 0 0 !important; border-bottom: none !important; box-shadow: none; } .page:has(#anMusic-page) #page-header.not-top-img #nav a, .page:has(#anMusic-page) #page-header #nav .back-home-button { color: #fff; } [data-theme="dark"] .page:has(#anMusic-page) #page-header:before { background-color: transparent; } @media screen and (max-width: 768px) { body:has(#anMusic-page) #rightside { display: none; } #anMusic-page .aplayer-list { position: fixed; z-index: 1002; width: 100%; bottom: -76%; left: 0; background: var(--sidebar-bg); height: auto; border-radius: 15px 15px 0px 0px; padding: 15px 0px; } #anMusic-page .aplayer-list.aplayer-list-hide { bottom: 0% !important; } #anMusic-page ol { max-height: 60vh !important; padding-right: 0px; } #anMusic-page ol > li { display: flex; margin: 0 10px; } #anMusic-page ol > li span { color: var(--font-color); } #anMusic-page ol > li span.aplayer-list-title { width: 30%; max-width: 55%; width: auto; display: -webkit-box; -webkit-line-clamp: 1; overflow: hidden; -webkit-box-orient: vertical; } #anMusic-page ol > li span.aplayer-list-author { position: absolute; right: 10px; width: auto; max-width: 35%; display: -webkit-box; -webkit-line-clamp: 1; overflow: hidden; -webkit-box-orient: vertical; } #anMusic-page ol > li.aplayer-list-light { background: #33a673; padding: 5px 20px; border-radius: 10px; } #anMusic-page ol > li.aplayer-list-light span { color: #fff; } #anMusic-page ol > li.aplayer-list-light span.aplayer-list-author { right: 15px; } #anMusic-page .aplayer-body { width: 100%; position: fixed; margin: auto; left: 0; right: 0; top: 100px; } #anMusic-page .aplayer-info .aplayer-lrc { margin-top: 40px; height: auto; max-height: 200%; min-height: 100%; mask-image: linear-gradient( to bottom, #000, #000, #000, #000, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) ); } #anMusic-page .aplayer-info .aplayer-lrc p.aplayer-lrc-current { color: #33a673; } #anMusic-page .aplayer-info .aplayer-controller { width: 100%; bottom: 100px; } #anMusic-page .aplayer-info .aplayer-controller .aplayer-bar-wrap { margin: 0 30px; } #anMusic-page .aplayer-info .aplayer-time { bottom: -40px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner { position: absolute; width: 100%; margin-right: 0; margin-top: -33px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner .aplayer-dtime { position: absolute; right: 30px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner .aplayer-ptime { position: absolute; left: 35px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back { margin: auto; right: 110px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play { margin: auto; right: 0; left: 0; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward { margin: auto; left: 110px; right: 0; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-order { position: absolute; left: 22px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-loop { position: absolute; right: 25px; } #anMusic-page .aplayer-info .aplayer-time .aplayer-icon-menu { display: inline; position: absolute; right: 25px; top: -90px; } #anMusic-page .aplayer-volume-bar-wrap { bottom: 0px; right: 7px; } #anMusic-page .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap { left: -66px; } body:has(#anMusic-page) #content-inner, body:has(#anMusic-page) #page { z-index: auto; } }
|
创建 music.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
var meting_api = "https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r"; var anzhiyu_music = { changeMusicBg: function (isChangeBg = true) { if (window.location.pathname != "/music/") { return; } const anMusicBg = document.getElementById("an_music_bg");
if (isChangeBg) { const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); anMusicBg.style.backgroundImage = musiccover.style.backgroundImage; } else { let timer = setInterval(() => { const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); if (musiccover) { clearInterval(timer); anzhiyu_music.addEventListenerChangeMusicBg(); } }, 100); } }, addEventListenerChangeMusicBg: function () { const anMusicPage = document.getElementById("anMusic-page"); const aplayerIconMenu = anMusicPage.querySelector( ".aplayer-info .aplayer-time .aplayer-icon-menu" );
anMusicPage .querySelector("meting-js") .aplayer.on("loadeddata", function () { anzhiyu_music.changeMusicBg(); console.info("player loadeddata"); });
aplayerIconMenu.addEventListener("click", function () { document.getElementById("menu-mask").style.display = "block"; document.getElementById("menu-mask").style.animation = "0.5s ease 0s 1 normal none running to_show"; });
document.getElementById("menu-mask").addEventListener("click", function () { if (window.location.pathname != "/music/") return; anMusicPage .querySelector(".aplayer-list") .classList.remove("aplayer-list-hide"); }); }, };
anzhiyu_music.changeMusicBg(false);
|
在_config.butterfly.yml
中注入代码添加配置,其中 id
为歌单 id
1 2 3 4 5 6 7 8 9
|
anzhiyu_music: enable: true id: "2004259211" server: netease customJS: customCSS: /css/music.css front_matter: /scripts/music.js
|
效果
标题居中
在 butterfly
的最近几个版本中改成了标题居左下,居中需要修改 themes/butterfly/source/css/_layout/head.styl
1 2 3 4 5 6 7 8 9 10
| #post-info position: absolute - bottom: 30px + bottom: 100px padding: 0 8% width: 100% + text-align: center
+maxWidth768() bottom: 22px
|
效果
波浪效果
修改 themes/butterfly/layout/includes/header/index.pug
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| if top_img !== false if is_post() include ./post-info.pug + section.main-hero-waves-area.waves-area + svg.waves-svg(xmlns='http://www.w3.org/2000/svg', xlink='http://www.w3.org/1999/xlink', viewBox='0 24 150 28', preserveAspectRatio='none', shape-rendering='auto') + defs + path#gentle-wave(d='M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z') + g.parallax + use(href='#gentle-wave', x='48', y='0') + use(href='#gentle-wave', x='48', y='3') + use(href='#gentle-wave', x='48', y='5') + use(href='#gentle-wave', x='48', y='7') #post-top-cover img#post-top-bg(class='nolazyload' src=bg_img) else if is_home() #site-info h1#site-title=site_title if theme.subtitle.enable
|
添加 wave.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| .main-hero-waves-area { width: 100%; position: absolute; left: 0; bottom: -11px; z-index: 5; } .waves-area .waves-svg { width: 100%; height: 5rem; }
.parallax > use { animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; } .parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 7s; fill: #f7f9febd; } .parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 10s; fill: #f7f9fe82; } .parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 13s; fill: #f7f9fe36; } .parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 20s; fill: #f7f9fe; }
[data-theme="dark"] .parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 7s; fill: #18171dc8; } [data-theme="dark"] .parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 10s; fill: #18171d80; } [data-theme="dark"] .parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 13s; fill: #18171d3e; } [data-theme="dark"] .parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 20s; fill: #18171d; }
@keyframes move-forever { 0% { transform: translate3d(-90px, 0, 0); } 100% { transform: translate3d(85px, 0, 0); } }
@media (max-width: 768px) { .waves-area .waves-svg { height: 40px; min-height: 40px; } }
|
效果