Commit e86908eb authored by Benjamin Gallois's avatar Benjamin Gallois

Moving white circle on black background

var circle = document.getElementById('circle');
var circleX = 0;
var circleY = 0;
function move(event) {
var x = event.clientX;
var y = event.clientY;
var a = circle.offsetWidth;
var buttonPressed = event.buttons
if (buttonPressed == 1){ = x - a/2 + 'px'; = y - a/2 + 'px';
#circle {
width: 200px;
height: 200px;
border-radius: 50%;
background-color: white;
position: relative;
body {
background-color: black;
color: white;
<title>Phototaxis fête de la science</title>
<link rel="stylesheet" type="text/css" href="main.css">
<body onmousemove="move(event)">
<div id="circle"></div>
<script src="app.js" type="text/javascript"></script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment