<a herf="data:text/html;charset=utf-8,%3C!DOCTYPE html%3E%3Chtml lang%3D"fr"%3E%3Chead%3E%3Cmeta charset%3D"UTF-8"%3E%3Ctitle%3EPong%3C/title%3E%3Cstyle%3Ebody%7Bmargin%3A0;background%3A%23000;display%3Aflex;justify-content%3Acenter;align-items%3Acenter;height%3A100vh;font-family%3AArial%2Csans-serif;color%3Awhite;flex-direction%3Acolumn;%7Dcanvas%7Bbackground%3A%23111;display%3Ablock;margin%3A20px auto;border%3A2px solid%23fff;%7Dh1%7Bmargin-bottom%3A0;%7D%3C/style%3E%3C/head%3E%3Cbody%3E%3Ch1%3EPong%3C/h1%3E%3Ccanvas id%3D"game" width%3D500 height%3D400%3E%3C/canvas%3E%3Cscript%3Econst canvas%3Ddocument.getElementById('game')%2Cctx%3Dcanvas.getContext('2d')%3Blet paddleY%3D150%2CpaddleHeight%3D80%2CpaddleWidth%3D10%2CballX%3D250%2CballY%3D200%2CballRadius%3D10%2CballSpeedX%3D2%2CballSpeedY%3D2%2CaiY%3D150%3Bdocument.addEventListener('mousemove'%2Ce%3D%3E%7BpaddleY%3De.clientY-canvas.getBoundingClientRect().top-paddleHeight%2F2%3Bif(paddleY%3C0)paddleY%3D0%3Bif(paddleY%3Ecanvas.height-paddleHeight)paddleY%3Dcanvas.height-paddleHeight%7D)%3Bfunction resetBall()%7BballX%3Dcanvas.width%2F2%3BballY%3Dcanvas.height%2F2%3BballSpeedX%3D-2%3BballSpeedY%3D2%7Dfunction draw()%7Bctx.fillStyle%3D'%23111'%3Bctx.fillRect(0%2C0%2Ccanvas.width%2Ccanvas.height)%3Bctx.fillStyle%3D'white'%3Bctx.fillRect(10%2CpaddleY%2CpaddleWidth%2CpaddleHeight)%3Bctx.fillRect(canvas.width-20%2CaiY%2CpaddleWidth%2CpaddleHeight)%3Bctx.beginPath()%3Bctx.arc(ballX%2CballY%2CballRadius%2C0%2CMath.PI*2)%3Bctx.fillStyle%3D'red'%3Bctx.fill()%3Bctx.closePath()%7Dfunction update()%7BballX%2B%3DballSpeedX%3BballY%2B%3DballSpeedY%3Bif(ballY+ballRadius%3Ecanvas.height%7C%7CballY-ballRadius%3C0)ballSpeedY%3D-ballSpeedY%3Bif(ballX-ballRadius%3C20%26%26ballY%3EpaddleY%26%26ballY%3CpaddleY+paddleHeight)ballSpeedX%3D-ballSpeedX%3Bif(ballX+ballRadius%3Ecanvas.width-20%26%26ballY%3EaiY%26%26ballY%3CaiY+paddleHeight)ballSpeedX%3D-ballSpeedX%3Bif(aiY+paddleHeight%2F2%3CballY)aiY%2B%3D1.5%3Belse aiY-= 1.5%3Bif(aiY%3C0)aiY%3D0%3Bif(aiY%3Ecanvas.height-paddleHeight)aiY%3Dcanvas.height-paddleHeight%3Bif(ballX%3C0%7C%7CballX%3Ecanvas.width)resetBall()%7Dfunction loop()%7Bupdate()%3Bdraw()%3BrequestAnimationFrame(loop)%7Dloop()%3C/script%3E%3C/body%3E%3C/html%3E">jeu</a>
Thiag0 : C'est du HTML.
28/11/2025 14:40