canvas

Uncaught TypeError: Cannot read property 'getContext' of null

Inserted the code on JSHint no error, but the browser gives Uncaught TypeError: Cannot read property 'getContext' of null at ... box = 32; var score = 0; function drawGame() { ctx.drawImage(ground, 0,0); } var game = setInterval(drawGame, 100);

HTML5 Canvas: How do I update the canvas?

How do I update the canvas canvas? clearRect(0, 0, 500, 500); - and how do I specify which canvas to update?

Screenshot of a specific part of the screen using html5

Hello, dear friends. There is such a task: Turn the contents of the div block into an image and invite the user to download i ... extension and even without a name. Is there any way, without involving server technologies, to give a name to the screenshot?

How do I draw a circle in Tkinter?

shape_id =canvas.create_oval(10,10,10,10, outline="red", fill="green", width=2) How do I set the radius of a circle in canvas? As far as I understand, there is no such attribute here.

drawing with the mouse canvas

There is a problem when the user draws a 4-square shape on the canvas, when you move the mouse, the stroke shape is drawn and ... 101px;"> </canvas> <input type="button" id="clear" name="clear" value="Очистить" /> </div>

Paint on canvas: drawing with the mouse

Why do the coordinates of the drawn squares not match the coordinates of the mouse? var canvas = document.getElementByI ... 3px solid black; margin: 40px; } <canvas id="cl">Подключите</canvas> <input type="color" id="color">

How to draw and animate a train?

I was interested in the work of participant @Arthur, where he drew and animated the movement of the train using SVG technolo ... r means and technologies for drawing and creating the effect animations and transformations specified in the question labels?

Java. Canvas. JFrame

The code below draws a line, each second a new one. How can a new line be added to the old one?That is, I want to see twenty ... (Math.random() * 100); MyCanvas.x2 = (int)(Math.random() * 100); canvas.repaint(); } } }

Canvas color picker

When you hover the cursor, the color of the pixel should be displayed in the neighboring block. Problem: the height of the ca ... height: 50px; background-color: red; } <canvas id="canvas"></canvas> <div id="block"></div>

ctx. clearRect doesn't work in setInterval

var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); var ball = { x: 150, y: 400 } b ... ); ball.move(); ctx.strokeRect(0, 0, 300, 400) }, 30) <canvas id="canvas" width="300" height="400"></canvas>

js canvas draw special characters

You need to output the special character alpha (α) ctx.fillText("&alpha;",50,195); Outputs the same text &alpha; How do I draw a special character?

Simulating a click on an object in canvas JS

I'm trying to simulate clicking on an object in canvas, but I can't do it. I tried many different options here is one of them ... he console writes true, but the canvas itself does not respond to the event in any way. Could you help me solve this problem?

How do I draw a gradient on canvas?

I wrote colorpicker, almost without images, only one is used, canvas is used to build the Hue scale, so I want to replace the ... g on the right - transparent. Here is a similar implementation only there is a picture: www.colorpicker.com. Please help me

Converting mm to pixels

Faced with such a problem - I need to set the size of the canvas element 93mm x 53mm, but I can only set the size in pixels. ... a different number of pixels, depending on the resolution of the monitor. Please tell me what I should do in this situation?

How to create a 2D game correctly, if not in Canvas

I have often seen people write{[1] in comments or answers to questions about problems with Canvas]} Which... you have a gam ... s are stretched. It turns out how to make UI objects and in general the entire 2D game consisting of them outside of Canvas?

JavaScript+Canvas: Plot a function graph

Create a web page displaying the graph of the function y=ax^2+bx+c On the page, we set the values of the variables a, b,c and ... ;canvas></canvas> This image is taken from my course and shows how this task should look like in the final

How to create an animated Stackoverflow icon

Below are the images of the EnSO and RuSO icons: EnSO icon code <svg xmlns="http://www.w3.org/2000/svg" width= ... owner of the Sevastopol ' As the author of the work who most accurately completed all the points of the competition task

Boom! How to draw and animate a bomb?

I have this code: /*Бомба*/ .bomb { position: absolute; bottom: 0; right: 7%; width: 15%; height: 0; paddin ... technologies other than CSS for drawing and creating the animation and transformation effect specified in the question marks?

how to stop the game under a certain condition(Canvas JS)

I created something like a game, now the task that I do not understand how to implement: if the ball touches at least one rec ... Style='white' } } let app=new Game() app.play() </script> </body> </html>

How to animate the word StackOverflow

I have the word StackOverflow: <h1>StackOverflow</h1> How do I create an animation effect for this wor ... ooping animation How to implement a similar scenario of such animation using any technology specified in the question marks?