partey_workadventure/maps/tests/Outline/outline.php
David Négrier 90f7287860 Adding the ability to set the player's color outline via the scripting API
(currently not shared with the other players yet)
2021-12-21 17:02:53 +01:00

37 lines
1.3 KiB
PHP

<!doctype html>
<html lang="en">
<head>
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
<script>
WA.onInit().then(() => {
console.log('After WA init');
const setOutlineButton = document.getElementById('setOutline');
const removeOutlineButton = document.getElementById('removeOutline');
const redField = document.getElementById('red');
const greenField = document.getElementById('green');
const blueField = document.getElementById('blue');
setOutlineButton.addEventListener('click', () => {
console.log('SETTING OUTLINE');
WA.player.setOutlineColor(parseInt(redField.value), parseInt(greenField.value), parseInt(blueField.value));
});
removeOutlineButton.addEventListener('click', () => {
console.log('REMOVING OUTLINE');
WA.player.removeOutlineColor();
});
});
</script>
</head>
<body>
red: <input type="text" id="red" value="0" /><br/>
green: <input type="text" id="green" value="0" /><br/>
blue: <input type="text" id="blue" value="0" /><br/>
<button id="setOutline">Set outline</button>
<button id="removeOutline">Remove outline</button>
</body>
</html>