This commit is contained in:
awesomeuser 2023-07-07 21:52:13 +00:00
parent 5010652a52
commit 73d8b73284

View file

@ -78,15 +78,26 @@
var header = document.getElementById("header");
var awdog = document.getElementById("awdog");
var intensity = 0;
function pet() {
alert("pet");
intensity = 10;
}
var prevTime = 0;
async function update(timestamp) {
let dt = (timestamp - prevTime) / 1000;
prevTime = timestamp;
// petting shake
let a = Math.random() * Math.PI * 2;
let intensity = 20;
awdog.style.transform = "translate(" + (Math.cos(a) * intensity) + "px, " + (Math.sin(a) * intensity) + "px)";
if (intensity > 0) {
intensity -= 10 * dt;
} else {
intensity = 0;
}
// header
let t = timestamp / 500;