mirror of
https://github.com/Stone-Red-Code/Stone-Red-Code.github.io.git
synced 2026-09-04 09:06:28 +02:00
Added "fun" page
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
let speed = 20;
|
||||
let scale = 0.15;
|
||||
let canvas;
|
||||
let ctx;
|
||||
|
||||
let image = {
|
||||
x: -4,
|
||||
y: -4,
|
||||
xspeed: 5,
|
||||
yspeed: 5,
|
||||
img: new Image()
|
||||
};
|
||||
|
||||
(function main() {
|
||||
canvas = document.getElementById("mainpanel");
|
||||
ctx = canvas.getContext("2d");
|
||||
image.img.src = 'http://github.com/Stone-Red-Code.png';
|
||||
canvas.style.width = '100%';
|
||||
canvas.style.height = '100%';
|
||||
canvas.width = 1000;
|
||||
canvas.height = 500;
|
||||
update();
|
||||
})();
|
||||
|
||||
function update() {
|
||||
setTimeout(() => {
|
||||
ctx.fillStyle = 'transparent';
|
||||
ctx.fillRect(image.x, image.y, image.img.width * scale, image.img.height * scale);
|
||||
ctx.drawImage(image.img, image.x, image.y, image.img.width * scale, image.img.height * scale);
|
||||
|
||||
image.x += image.xspeed;
|
||||
image.y += image.yspeed;
|
||||
|
||||
checkCollision();
|
||||
update();
|
||||
}, speed)
|
||||
}
|
||||
|
||||
function checkCollision() {
|
||||
if (image.x + image.img.width * scale >= canvas.width || image.x <= 0) {
|
||||
image.xspeed *= -1;
|
||||
}
|
||||
|
||||
if (image.y + image.img.height * scale >= canvas.height || image.y <= 0) {
|
||||
image.yspeed *= -1;
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -1,5 +1,5 @@
|
||||
window.onload = function() {
|
||||
var answerArray = new Array(
|
||||
|
||||
let answerArray = new Array(
|
||||
"“A million sorry’s is not equal to 1 thank you.” – Emilia (Re:Zero)",
|
||||
"“When you said that you hate yourself, it made me want to tell you all the wonderful things I know about you.” – Rem (Re:Zero)",
|
||||
"“No matter what happens, even when it looks like you’re gonna lose, when no one else believes in you, when you don’t believe in your self, I will believe!” – Rem (Re:Zero)",
|
||||
@@ -27,7 +27,6 @@ window.onload = function() {
|
||||
"“Make the best of a bad situation.” – Aqua (KonoSuba)",
|
||||
"“This sunlight is my worst enemy after three straight all-nighters.” – Kazuma Satou (KonoSuba)"
|
||||
);
|
||||
|
||||
|
||||
document.getElementById('quotes').innerHTML = answerArray[Math.floor(Math.random() * answerArray.length)];
|
||||
document.getElementById('quotes').classList.add("fade-in");
|
||||
}
|
||||
document.getElementById('quotes').classList.add("fade-in");
|
||||
Reference in New Issue
Block a user