Questions tagged [Canvas] (792)

0
answer

How to optimize JS in frame-by-frame animation to a Canvas?

There is JS script where there is an array of Image objects already loaded (the animation frames PNG format), and there is canvas. Also there is a function which clears the canvas (clearRect) and then using drawImage draws the next frame in the array. The problem is that if you take two (or more) canvas with frame animation...
jabari.Jaskolski asked April 19th 20 at 12:44
2
answers

Canvas how to move an object?

how to move the triangle in the canvas by the values of top left
Coy.Bogan asked April 19th 20 at 12:03
0
answer

How to scale the viewPort center?

Do my view, the type of card, trying to make scale, but that the object in the center, remained in the center. It turns out adequately only if the scale of 1, and then the viewport went the wrong way. class MyView : View { constructor(ctx: Context) : super(ctx) constructor(ctx: Context, attrs: AttributeSet) : super(ctx,...
Delpha asked April 18th 20 at 13:25
2
answers

How to plot Canvas?

You can't build a graph using JS and Canvas. I can not understand algorithm of the connection lines with coordinates Y, have the values: 100, 10, 0. The problem is that you need the Y coordinates to reduce to the difference between the values fit on the chart was limited by the size of the graph, i.e. the graph could be sca...
Nico.Bogisich90 asked April 18th 20 at 13:21
0
answer

As you can realize the gradient using threejs?

As you can realize the gradient for CylinderBufferGeometry? Preferably not using shaders #D0D2ED - #FFFFF
Adell_Harber asked April 18th 20 at 13:09
1
answer

After cropping the photo on the front, to load this photo on a server?

Good evening, tell me how after cropping the photo on the front is a cropped photo in zip File to send to the server, that is here in this format Below is an example of cropping a photo on the front const reader = new FileReader() reader.onload = () => { const img = new Image() img.src = reader.result const canvas ...
Theresa.Harvey asked April 18th 20 at 13:04
0
answer

How to make the implementation to after sunset on the dead zone in the Canvas of the player he remained in the same coordinates, but did not come to this area?

Good day! There is a small example of a game where the player moves in the zone, but if he walks into a dead zone, then the page reloads. It is necessary that the player remained in the same coordinates, but did not go to the dead zone. window.onload = start_game; const game = document.getElementById("game"); const ctx = g...
Wilmer.Wisoky1 asked April 18th 20 at 12:35
1
answer

How to draw in a canvas a line at an angle, knowing the length?

Is there any function in canvas to draw a line at an angle desired length?
krystal.Wisozk asked April 16th 20 at 11:21
2
answers

Why canvas does not accept dynamic src?

Why canvas does not accept dynamic src code var canvas = document.getElementById("myCanvas"), context = canvas.getContext("2d"); contextT = canvas.getContext("2d"); var img = new Image(); var imgflag_1 = new Image(); var imgflag_2 = new Image(); var imgflag_3 = new Image(); var imgflag_4 = new Image(); var imgUSER...
Keegan asked April 16th 20 at 09:57
1
answer

How can I speed up the rendering in the canvas?

Studying the technology of ray marching and write a small project in web. When it comes to rendering full hd images, the page hangs for about 20 seconds and is a lot. How to increase the speed of rendering, and do like in other 3D engines for the web, where 1 frame takes a fraction of a second? If you need code, then it li...
malika asked April 9th 20 at 10:53