how to make a rectangle in javascript
// canvas context.fillRect(x, y, height, width);
ctx.fillRect(20, 20, 150, 100);const canvas = document.getElementById('pong') // first make a index . html with a canvas height and width and id of pong or whatever
// and then we have to get access to our context to draw on it
const context = canvas.getContext('2d')
// then you do...
context.drawRect(20, 20, 150, 150);
context.fillStyle = '#fff' // thats white!!<html>
<head>
<meta charset="UTF-8">
<title>Pong</title>
<script language="Javascript" type="text/Javascript" src="libraries/p5.js"></script>
<script language="Javascript" type="text/Javascript" src="pong.js" defer></script>
<style> body {padding: 0; margin: 0;} </style>
</head>
<body>
<canvas id="pong" width="600" height="400"></canvas>
</body>
</html>
Also in JavaScript:
- javascript loadImage
- function javascript
- utiliser les données passees a un modal dans son propre composant en angular
- creating react app using npx
- How find a specific character in js
- show password fa-eye javascript
- vowel
- node js util promisify
- networkx check if node exists
- Hoisting in JavaScript MDN
- javascript var vs let
- check for balanced parentheses in javascript
- npm ERR! Unexpected end of JSON input while parsing near '...r\nComment: https://o'
- how to print in js
- react disable eslint errors
- mongoose findoneandupdate
- javascript check if argument is passed
- react check if browser is in dark mode
- javascript group by on array of objects
- js combine 2 array to object key value
- class inheritance method javascript
- eliminare spazi inizio e fine stringa javascript
- jquery get current row value
- react native flatlist pull to refresh