Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- const canvas = document.getElementById("mycanvas");
- console.log(canvas);
- let ctx = canvas.getContext("2d");
- // get context to draw on canvas
- let DIMENSION = 25;
- let WIDTH = canvas.width;
- let HEIGHT = canvas.height;
- ctx.strokeStyle = 'rgba(0,0,0,0.1)';
- for (let i = 0; i < DIMENSION; ++i) {
- x = Math.floor(i * WIDTH / DIMENSION);
- ctx.beginPath();
- ctx.moveTo(x, 0);
- ctx.lineTo(x, HEIGHT);
- ctx.stroke();
- y = Math.floor(i * HEIGHT / DIMENSION);
- ctx.beginPath();
- ctx.moveTo(0, y);
- ctx.lineTo(WIDTH, y);
- ctx.stroke();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment