bby
bby
This commit is contained in:
51
js/bj.js
Normal file
51
js/bj.js
Normal file
@@ -0,0 +1,51 @@
|
||||
var canvas;
|
||||
var stars_count;
|
||||
var stars;
|
||||
ini();
|
||||
makeStars();
|
||||
var interval=setInterval(function(){drawStars();},50);//<2F><>ʱˢ<CAB1><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
function ini(){//<2F><>ʼ<EFBFBD><CABC>
|
||||
canvas = document.getElementById("starfield");
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
context = canvas.getContext("2d");
|
||||
stars = Array();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>x,y,<2C><>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ٶȣ<D9B6>
|
||||
stars_count = 300;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
function makeStars(){//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(var i=0;i<stars_count;i++)
|
||||
{
|
||||
let x=Math.random() * canvas.offsetWidth;
|
||||
let y = Math.random() * canvas.offsetHeight;
|
||||
let radius = Math.random()*0.8;
|
||||
let color="rgba("+Math.random()*255+","+Math.random()*255+","+Math.random()*255+",0.8)";
|
||||
let speed=Math.random()*0.5;
|
||||
let arr={'x':x,'y':y,'radius':radius,'color':color,'speed':speed};//<2F><>x,y,<2C><>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ٶȣ<D9B6>
|
||||
stars.push(arr);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
|
||||
function drawStars(){//<2F><><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
context.fillStyle = "#0e1729";
|
||||
context.fillRect(0,0,canvas.width,canvas.height);
|
||||
for (var i = 0; i < stars.length; i++) {
|
||||
var x = stars[i]['x'] - stars[i]['speed'];
|
||||
if(x<-2*stars[i]['radius']) x=canvas.width;
|
||||
stars[i]['x']=x;
|
||||
var y = stars[i]['y'];
|
||||
var radius = stars[i]['radius'];
|
||||
context.beginPath();
|
||||
context.arc(x, y, radius*2, 0, 2*Math.PI);
|
||||
context.fillStyle = "rgba("+Math.random()*255+","+Math.random()*255+","+Math.random()*255+",0.8)";
|
||||
context.fill();
|
||||
}
|
||||
}
|
||||
|
||||
window.onresize = function(){//<2F><><EFBFBD>ڴ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>仯ʱ<E4BBAF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ini();
|
||||
makeStars();
|
||||
interval=setInterval(function(){drawStars();},50);
|
||||
}
|
||||
1
js/fetch.min.js
vendored
Normal file
1
js/fetch.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/jquery.min.js
vendored
Normal file
2
js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
104
js/main.js
Normal file
104
js/main.js
Normal file
@@ -0,0 +1,104 @@
|
||||
var iUp = (function () {
|
||||
var t = 0,
|
||||
d = 150,
|
||||
clean = function () {
|
||||
t = 0;
|
||||
},
|
||||
up = function (e) {
|
||||
setTimeout(function () {
|
||||
$(e).addClass("up")
|
||||
}, t);
|
||||
t += d;
|
||||
},
|
||||
down = function (e) {
|
||||
$(e).removeClass("up");
|
||||
},
|
||||
toggle = function (e) {
|
||||
setTimeout(function () {
|
||||
$(e).toggleClass("up")
|
||||
}, t);
|
||||
t += d;
|
||||
};
|
||||
return {
|
||||
clean: clean,
|
||||
up: up,
|
||||
down: down,
|
||||
toggle: toggle
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// 获取一言数据
|
||||
fetch('https://v1.hitokoto.cn').then(function (res) {
|
||||
return res.json();
|
||||
}).then(function (e) {
|
||||
$('#description').html(e.hitokoto + "<br/> -「<strong>" + e.from + "</strong>」")
|
||||
}).catch(function (err) {
|
||||
console.error(err);
|
||||
})
|
||||
// var url = 'https://query.yahooapis.com/v1/public/yql' +
|
||||
// '?q=' + encodeURIComponent('select * from json where url=@url') +
|
||||
// '&url=' + encodeURIComponent('https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8') +
|
||||
// '&format=json&callback=?';
|
||||
|
||||
/**
|
||||
* 获取Bing壁纸
|
||||
* 原先 YQL 已经无法提供服务了
|
||||
* 改用 JsonBird:https://bird.ioliu.cn/
|
||||
*
|
||||
*/
|
||||
var url = '';
|
||||
var imgUrls = JSON.parse(sessionStorage.getItem("imgUrls"));
|
||||
var index = sessionStorage.getItem("index");
|
||||
var $panel = $('#panel');
|
||||
if (imgUrls == null) {
|
||||
imgUrls = new Array();
|
||||
index = 0;
|
||||
$.get(url, function (result) {
|
||||
images = result.images;
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
const item = images[i];
|
||||
imgUrls.push(item.url);
|
||||
}
|
||||
var imgUrl = imgUrls[index];
|
||||
var url = "https://www.bing.com" + imgUrl;
|
||||
$panel.css("background", "url('" + url + "') center center no-repeat #666");
|
||||
$panel.css("background-size", "cover");
|
||||
sessionStorage.setItem("imgUrls", JSON.stringify(imgUrls));
|
||||
sessionStorage.setItem("index", index);
|
||||
});
|
||||
} else {
|
||||
if (index == 7)
|
||||
index = 0;
|
||||
else
|
||||
index++;
|
||||
var imgUrl = imgUrls[index];
|
||||
var url = "https://www.bing.com" + imgUrl;
|
||||
$panel.css("background", "url('" + url + "') center center no-repeat #666");
|
||||
$panel.css("background-size", "cover");
|
||||
sessionStorage.setItem("index", index);
|
||||
}
|
||||
|
||||
$(".iUp").each(function (i, e) {
|
||||
iUp.up(e);
|
||||
});
|
||||
|
||||
$(".js-avatar")[0].onload = function () {
|
||||
$(".js-avatar").addClass("show");
|
||||
}
|
||||
});
|
||||
|
||||
$('.btn-mobile-menu__icon').click(function () {
|
||||
if ($('.navigation-wrapper').css('display') == "block") {
|
||||
$('.navigation-wrapper').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
|
||||
$('.navigation-wrapper').toggleClass('visible animated bounceOutUp');
|
||||
$('.navigation-wrapper').off('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
|
||||
});
|
||||
$('.navigation-wrapper').toggleClass('animated bounceInDown animated bounceOutUp');
|
||||
|
||||
} else {
|
||||
$('.navigation-wrapper').toggleClass('visible animated bounceInDown');
|
||||
}
|
||||
$('.btn-mobile-menu__icon').toggleClass('social iconfont icon-list social iconfont icon-ngleup animated fadeIn');
|
||||
});
|
||||
Reference in New Issue
Block a user