Created
January 27, 2022 02:49
-
-
Save UltiRequiem/916ad525bd2f785f8fd6fb3df199954e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const size = 10.0; | |
const clr = 0.0; | |
const ps = 0.0; | |
rust | |
.then((canvas) => { | |
var nodes = document.getElementsByTagName("button"); | |
for (var i = 0; i < nodes.length; i++) { | |
nodes[i].addEventListener( | |
"click", | |
function (i) { | |
console.log("You clicked element #" + i); | |
const color = [ | |
Math.abs(Math.cos(clr)), | |
Math.abs(Math.sin(clr)), | |
Math.abs(Math.sin(clr / 2) * Math.cos(clr * 2)), | |
1.0, | |
]; | |
const prop = { | |
color: color, | |
size: [100, 100], | |
marg: [20, 20], | |
pose: [ps * 200, Math.cos(ps) * 200 + 200], | |
shadow_size: size, | |
radius: 40.0, | |
}; | |
canvas.add_obj("ololo", prop); | |
canvas.update(); | |
clr += 0.1; | |
ps += 0.2; | |
}.bind(null, i) | |
); | |
} | |
}) | |
.catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment