run after that banana bonzi
This commit is contained in:
parent
2602f82d26
commit
db3a938a0b
BIN
banana.png
Normal file
BIN
banana.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
35
index.html
35
index.html
@ -21,7 +21,7 @@
|
|||||||
color: #20C20E;
|
color: #20C20E;
|
||||||
font-family: 'VT323', monospace;
|
font-family: 'VT323', monospace;
|
||||||
font-size: 16pt;
|
font-size: 16pt;
|
||||||
cursor: none;
|
cursor: url('banana.png'), auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@ -52,9 +52,10 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cursor {
|
#bonzi {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translate(-95%, -45%);
|
transition: transform 0.8s;
|
||||||
|
transform-style: preserve-3d;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<img alt='cursor' id='cursor' src='bonzi.png'/>
|
<img alt='bonzi' id='bonzi' src='bonzi.png'/>
|
||||||
<iframe allowfullscreen height='360px' id='live' referrerpolicy='origin' scrolling='no'
|
<iframe allowfullscreen height='360px' id='live' referrerpolicy='origin' scrolling='no'
|
||||||
src='https://live.vance.land/vance/' title='live.vance.land' width='640px'>
|
src='https://live.vance.land/vance/' title='live.vance.land' width='640px'>
|
||||||
</iframe>
|
</iframe>
|
||||||
@ -135,14 +136,28 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const cursor = document.getElementById('cursor');
|
const bonzi = document.getElementById('bonzi');
|
||||||
const live = document.getElementById('live');
|
const live = document.getElementById('live');
|
||||||
|
|
||||||
// bonzi cursor
|
// bonzi
|
||||||
|
let mouseTop = 0;
|
||||||
|
let mouseLeft = 0;
|
||||||
|
let bonziTop = 0;
|
||||||
|
let bonziLeft = 0;
|
||||||
|
const speed = 0.02;
|
||||||
|
function moveBonzi() {
|
||||||
|
bonzi.style.transform = bonziLeft > mouseLeft ? 'translate(5%, -35%) scaleX(-1)' : 'translate(-80%, -35%)';
|
||||||
|
bonziTop = bonziTop + ((mouseTop - bonziTop) * speed);
|
||||||
|
bonziLeft = bonziLeft + ((mouseLeft - bonziLeft) * speed);
|
||||||
|
bonzi.style.top = `${bonziTop}px`;
|
||||||
|
bonzi.style.left = `${bonziLeft}px`;
|
||||||
|
requestAnimationFrame(moveBonzi);
|
||||||
|
}
|
||||||
|
moveBonzi();
|
||||||
['mousemove', 'touchstart', 'touchmove'].forEach(type => {
|
['mousemove', 'touchstart', 'touchmove'].forEach(type => {
|
||||||
window.addEventListener(type, event => {
|
window.addEventListener(type, event => {
|
||||||
cursor.style.top = (event.clientY || event.touches[0].clientY) + 'px';
|
mouseTop = event.clientY || event.touches[0].clientY;
|
||||||
cursor.style.left = (event.clientX || event.touches[0].clientX) + 'px';
|
mouseLeft = event.clientX || event.touches[0].clientX;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -156,8 +171,8 @@
|
|||||||
|
|
||||||
// resize iframe if view width is smaller than frame
|
// resize iframe if view width is smaller than frame
|
||||||
if (parseInt(live.width, 10) > vw) {
|
if (parseInt(live.width, 10) > vw) {
|
||||||
live.width = vw + 'px';
|
live.width = `${vw}px`;
|
||||||
live.height = vw * (9 / 16) + 'px';
|
live.height = `${vw * (9 / 16)}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if stream active every 5 seconds
|
// check if stream active every 5 seconds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user