test awdog quiver

This commit is contained in:
awesomeuser 2023-07-07 21:49:01 +00:00
parent 236404869c
commit 5010652a52

View file

@ -64,7 +64,7 @@
<h1 id="header">awesome.colean.cc</h1> <h1 id="header">awesome.colean.cc</h1>
<img src="res/awdog.png" width="160"><br> <img id="awdog" src="res/awdog.png" width="160" onclick="pet()"><br>
awdog, the mascot of awesome awdog, the mascot of awesome
<br><br> <br><br>
@ -76,8 +76,19 @@
<script> <script>
var header = document.getElementById("header"); var header = document.getElementById("header");
var awdog = document.getElementById("awdog");
function pet() {
alert("pet");
}
async function update(timestamp) { async function update(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)";
// header
let t = timestamp / 500; let t = timestamp / 500;
let x = Math.cos(t) * 20; let x = Math.cos(t) * 20;