博客园美化之--立方体+线条漂浮+鼠标特效
只是备份一下~
皮肤模板
页面定制CSS代码
不禁用模板默认CSS
<style>
html {
background: pink;
height: 100%;
}
/*最外层容器样式*/
.wrap {
width: 10px;
height: 10px;
/*改变左右上下,图片方块移动*/
margin: 300px 400px;
position: relative;
}
/*包裹所有容器样式*/
.cube {
width: 600px;
height: 400px;
margin: 0 auto;
transform-style: preserve-3d;
transform: rotateX(-50deg) rotateY(-80deg);
-webkit-animation: rotate 15s infinite;
/*匀速*/
animation-timing-function: linear;
}
@-webkit-keyframes rotate {
from {
transform: rotateX(0deg) rotateY(0deg);
}
to {
transform: rotateX(360deg) rotateY(360deg);
}
}
.cube div {
position: absolute;
width: 300px;
height: 300px;
opacity: 0.8;
transition: all .4s;
}
/*定义所有图片样式*/
.pic {
width: 300px;
height: 300px;
}
.cube .out_front {
transform: rotateY(0deg) translateZ(150px);
}
.cube .out_back {
transform: translateZ(-150px) rotateY(180deg);
}
.cube .out_left {
transform: rotateY(90deg) translateZ(150px);
}
.cube .out_right {
transform: rotateY(-90deg) translateZ(150px);
}
.cube .out_top {
transform: rotateX(90deg) translateZ(150px);
}
.cube .out_bottom {
transform: rotateX(-90deg) translateZ(150px);
}
/*定义小正方体样式*/
.cube span {
display: bloack;
width: 200px;
height: 200px;
position: absolute;
top: 50px;
left: 50px;
}
.cube .in_pic {
width: 200px;
height: 200px;
}
.cube .in_front {
transform: rotateY(0deg) translateZ(100px);
}
.cube .in_back {
transform: translateZ(-100px) rotateY(180deg);
}
.cube .in_left {
transform: rotateY(90deg) translateZ(100px);
}
.cube .in_right {
transform: rotateY(-90deg) translateZ(100px);
}
.cube .in_top {
transform: rotateX(90deg) translateZ(100px);
}
.cube .in_bottom {
transform: rotateX(-90deg) translateZ(100px);
}
/*鼠标移入后样式*/
.cube:hover .out_front {
transform: rotateY(0deg) translateZ(400px);
}
.cube:hover .out_back {
transform: translateZ(-400px) rotateY(180deg);
}
.cube:hover .out_left {
transform: rotateY(90deg) translateZ(400px);
}
.cube:hover .out_right {
transform: rotateY(-90deg) translateZ(400px);
}
.cube:hover .out_top {
transform: rotateX(90deg) translateZ(400px);
}
.cube:hover .out_bottom {
transform: rotateX(-90deg) translateZ(400px);
}
#home,#sideBarMain>div,#blog-sidecolumn>div>div,.catListView{
background-color: rgba(255, 255, 255, 0.3);
} // 修改其他边框的颜色
body {
background-color:whitesmoke;
} // 修改背景颜色为半透明`
#home {
opacity: 0.80;
margin: 0px auto;
width: 70%;
min-width: 950px;
background-color: #fff;
padding: 30px;
margin-top: 50px;
margin-bottom: 50px;
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
</style>
<script language="javascript" type="text/javascript">
var a=true
$('.blogStats').html('<svg t="1572571609950" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1124" width="19" height="19"><path class="col" d="M562.88 554.56c0 28.032-22.784 50.816-50.88 50.816s-50.816-22.72-50.816-50.816V113.792c0-28.032 22.784-50.816 50.816-50.816s50.88 22.784 50.88 50.816V554.56z" fill="#ff00f7" p-id="1125"></path><path class="col" d="M86.016 535.36c0-152.064 80.32-285.76 200.512-360.64 23.488-14.976 54.912-7.808 69.76 16 14.848 23.872 7.68 55.104-16.064 69.952-91.584 57.536-152.448 158.656-152.448 274.56C188.16 714.24 332.928 859.072 512 859.456c179.072-0.448 323.776-145.28 324.096-324.224 0-118.656-64-221.952-159.296-278.656-24.192-14.336-32.128-45.568-17.856-69.76 14.4-24.128 45.632-32.064 69.824-17.792 124.928 73.792 209.344 210.176 209.344 366.08 0 235.136-190.656 425.856-425.92 425.856-235.456 0.384-426.176-190.272-426.176-425.6" fill="#ff00f7" p-id="1126"></path></svg><span class="ic">关闭页面特效</span>')
$('.blogStats').click(function(){
if(a){
a=!a
$('.ic').text('');
$('.col').css('fill','#8a8a8a');
}else{
a=!a
$('.ic').text('关闭页面特效');
$('.col').css('fill','#ff00f7');
}
$('canvas').toggle();
});
function RefreshPage() {
return location.reload(1),
1
}
</script>
页首HTML代码
<div class="wrap">
<!-- /*包裹所有元素的容器*/-->
<div class="cube">
<!--前面图片 -->
<div class="out_front">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<!--后面图片 -->
<div class="out_back">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<!--左图片 -->
<div class="out_left">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<div class="out_right">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<div class="out_top">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<div class="out_bottom">
<img src="https://img2020.cnblogs.com/blog/1973699/202201/1973699-20220113102502367-74769322.jpg" class="pic">
</div>
<!--小正方体 -->
<span class="in_front">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154247351-202812358.jpg" class="in_pic" />
</span>
<span class="in_back">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154247351-202812358.jpg" class="in_pic" />
</span>
<span class="in_left">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154257226-1132254042.jpg" class="in_pic" />
</span>
<span class="in_right">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154257226-1132254042.jpg" class="in_pic" />
</span>
<span class="in_top">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154304308-960959160.jpg" class="in_pic" />
</span>
<span class="in_bottom">
<img src="https://img2020.cnblogs.com/blog/1973699/202108/1973699-20210827154304308-960959160.jpg" class="in_pic" />
</span>
</div>
</div>
页脚HTML代码
<canvas class="fireworks" style="position: fixed; left: 0px; top: 0px; z-index: 1; pointer-events: none; width: 1440px; height: 451px;" width="2880" height="902"></canvas>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/blogs/586816/anime.min.js"></script>
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/blogs/586816/anime.min2.js"></script>
<script type="text/javascript">
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("好吃的东西要吃进肚子里,可爱的人要放在心里","做个可爱的姑娘,不烦世事,慢心欢喜","岁岁常欢愉,万事皆胜意","你终究会成为你正在成为的人","越过山丘,美不胜收","但愿这漫长小小人生不辜负你每一个光辉时分","愿你一生努力,一生被爱,想要的都拥有,得不到的都释怀","不是每个游荡的人都迷了路,或许他正在追逐一个你无法想象的梦");
var $i = $("<span></span>").text(a[a_idx]);
a_idx = (a_idx + 1) % a.length;
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
"top": y - 20,
"left": x,
"position": "absolute",
"font-weight": "bold",
"color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
3500,
function() {
$i.remove();
});
});
});
</script>
<script id="c_n_script" src="https://blog-static.cnblogs.com/files/xiaokang01/js.js" color="215,107,110" opacity="4" count="100" zindex="-1">
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
} else {
}
</script>
<script>
/**
* 添加页脚
*/
function addFooter() {
const footer = $('#footer');
var pvHtml = '', bgFooter = '';
pvHtml += '<div>【<svg t="1599468900905" id="footerTextIcon" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21510" width="12" height="12"><path d="M696.9 208.6c-17.4 129.4-34.8 258.7-52.3 388.1-0.7 0-1.5 0.1-2.2 0.1-23.7-87.6-47.4-175.3-71-262.9h-2c-7.6 25.6-15.1 51.1-22.7 76.7-13.9 47-27.9 94.1-41.4 141.2-1.9 6.7-4.6 9-11.7 8.9-23.2-0.5-46.4-0.5-69.7 0-7.2 0.2-10.5-2.4-13.3-8.7-35.3-78.1-70.9-156-106.4-234-1.5-3.3-3.2-6.5-5.8-11.7-2.5 4.6-4.5 7.9-6.1 11.2-39.2 77.7-78.5 155.4-117.5 233.2-3.6 7.2-7.6 10.5-16 10-14.1-0.8-28.3 0.2-42.4-0.5-4.1-0.2-9.2-2.3-11.8-5.2C48.8 491 19 416.1 17.2 331.4 15 227.4 69.4 141.8 165.1 97.7 222.6 71.2 282 65.4 342.9 84.4c46.5 14.5 85.4 41.2 117.1 77.6 18.3 20.9 34 44.1 50.9 66.3 9.8-14 19.7-29.5 31-44 31.2-39.9 69-71.6 116.4-90.8 69.9-28.4 139-24.3 206 8.4 73.6 35.9 120.9 93.7 137.6 174.8 10.4 50.3 4.5 99.7-10 148.4s-38.6 92.2-71.9 130.7c-4.4 5.1-8.8 7.1-15.4 7.1-50.1-0.2-100.3-0.3-150.4 0-7.4 0-10.3-1.8-11.3-9.8-10.2-82.8-20.9-165.4-31.4-248.2-3.7-29-7.2-58.1-10.9-87.1-0.4-3.2-1.3-6.3-1.9-9.5-0.8 0.1-1.3 0.2-1.8 0.3z" fill="#FF2E2E" p-id="21511"></path><path d="M132.4 585.3c14.3 0 28.6-0.4 42.9 0.2 7.1 0.3 10.7-2.2 13.8-8.5 34-67.9 68.3-135.7 102.6-203.5 1.5-3 3.1-5.9 5.3-10 2.1 4.2 3.7 7.3 5.2 10.4 30.8 67.6 61.7 135.1 92.3 202.8 2.9 6.5 6.3 8.8 13.5 8.8 34.3-0.4 68.7-0.5 103 0.1 8.6 0.1 11.5-3.1 13.7-10.6 13.3-46.5 27.1-92.9 40.7-139.3 0.9-3.1 2.1-6.2 5.1-9.5 26.6 98.5 53.2 197 79.9 295.5 0.9 0.1 1.7 0.1 2.6 0.2 14.6-108.1 29.2-216.1 43.7-324.2h1.3c8.1 63.2 16.2 126.4 24.4 190.6h166.9c0.4 0.8 0.8 1.7 1.1 2.5C772 719.2 642.1 835.6 510 950.8c-131.6-116.1-261-233.5-378.7-363 0.4-0.9 0.7-1.7 1.1-2.5z" fill="#FF2E2E" p-id="21512"></path></svg>逃亡的布丁】</div>' + "<div><span id='blogRunTimeSpan'></span><span class='my-face'>ღゝ◡╹)ノ♡</span></div>" + '<div id="blogrollInfo">友情链接:<a rel="nofollow" href="https://blog.csdn.net/weixin_42744811?spm=1000.2115.3001.5343" target="_blank">小布丁的CSDN</a><span style="margin: 0 3px;">/</span><a rel="nofollow" href="https://b23.tv/MrJ1Ohw" target="_blank">小布丁的bilibili</a><span style="margin: 0 3px;"></div>';
init_t1();
window.setInterval( setRunTime, 500 );
// v1.0 页脚
function init_t1() {
pvHtml = '<div class="footer-image"></div>' + pvHtml;
addFooterHtml();
}
// 添加页脚
function addFooterHtml() {
const poweredby = $('#poweredby');
bgFooter && footer.prepend(bgFooter);
if (poweredby.length > 0) {
poweredby.before(pvHtml);
} else {
footer.append(pvHtml);
}
}
// 设置运行时间
function secondToDate(second) {
if (!second) {
return 0;
}
var time = new Array(0, 0, 0, 0, 0);
if (second >= 365 * 24 * 3600) {
time[0] = parseInt(second / (365 * 24 * 3600));
second %= 365 * 24 * 3600;
}
if (second >= 24 * 3600) {
time[1] = parseInt(second / (24 * 3600));
second %= 24 * 3600;
}
if (second >= 3600) {
time[2] = parseInt(second / 3600);
second %= 3600;
}
if (second >= 60) {
time[3] = parseInt(second / 60);
second %= 60;
}
if (second > 0) {
time[4] = second;
}
return time;
}
function setRunTime() {
var create_time = Math.round(new Date(Date.UTC(1999, 1, 4, 0, 0, 0)).getTime() / 1000);
var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
currentTime = secondToDate((timestamp - create_time));
var y = '<span style="color:#9acd32">'+currentTime[0]+'</span>' + '年';
if (currentTime[0] == 0) {
y = ''
} ;
$('#blogRunTimeSpan').html('小布丁已经出生'+y+ '<span style="color:#00a0ea">'+currentTime[1]+'</span>' + '天'
+'<span style="color:#ffa500">'+ currentTime[2] +'</span>' + '时' +'<span style="color:#dc7092">'+ currentTime[3]+'</span>' + '分' + '<span style="color:#ff0000">'+currentTime[4]+'</span>'
+ '秒了!');
}
};
addFooter();
</script>