Canvas is a drawing element introduced to web development with HTML5.

learn more… | top users | synonyms

2
votes
0answers
17 views

Fast draw wxPython OnPaint

I have the following wx.Window: ...
1
vote
1answer
38 views

Is context.clearRect() necessary?

My application is a bit slow. I believe this is because .clearRect is one of the more intensive events in my application so far. However I also draw an image on top ...
6
votes
1answer
47 views

Tracking (uniform spacing) between 2D elements

The problem I am solving: I select multiple 2D SVG elements in an editor(the elements are in arbitrary positions on my canvas). I run the function ...
1
vote
1answer
26 views

Grey to Colored Image

I want to improve the code, in which you can enter a grey bitmap and it will return you a colored one. ...
2
votes
1answer
80 views

Can the performance of this canvas drawImage() test be improved?

I have a quite simple loop that draws an 8px by 8px image many times in a canvas in a tiling fashion. Currently it's drawing 7500 images each loop. See the jsfiddle. ...
6
votes
1answer
96 views

HTML5 Tic-Tac-Toe game

I created an HTML5/JS tic-tac-toe game as an exercise and wanted some advice on my js code. A couple of questions: How can I improve the reset method? (currently reloads the page/re-initializes ...
2
votes
0answers
36 views

Isometric Projection and Culling

Link to live Codepen. Hello! I'm working on a small isometric drawing system, in Javascript. After much help from the Gamedev section, reading old questions, I've got something working. ...
10
votes
2answers
228 views

Canvas loading animation - follow-up

This is kind of a follow-on from here: Canvas animation I've been trying to copy the following GIF animation using a canvas. I have re-factored the code following Stuart's pointers and wanted to ...
5
votes
1answer
120 views

Canvas animation

Just started learning how to use the canvas today as I wanted to copy an animated GIF. The GIF I tried to copy is below. The animation does work but I've hacked it left and right. There's ...
4
votes
2answers
59 views

Photoshop Color Picker Gradient

I'm trying to improve my Color Picker code. It works like Photoshop and I don't want to use a library. ...
4
votes
2answers
112 views

Increase performance on canvas repainting

I'm working on a little project where I have to create sort of an image mask. Overall my code works quite good in all browsers but sporadically the animations "flickr" on Chrome (Windows). So I was ...
13
votes
4answers
993 views

Snake game with canvas element code

I created a classic snake game in the canvas element. I have not considered best practices when doing this, I just wanted to finish it first. Now it's time to improve the coding practice. You can ...
2
votes
1answer
68 views

Writing my own jQuery plugin

I am trying to write a jQuery Plugin from a piece of JS code I had written. What this plugin does is it converts a select box into a map of Australia where I can select individual states. It's ...
3
votes
2answers
55 views

Is this a good way of writing custom tag attributes and rendering code?

I've not done JavaScript in quite a while, but I wanted to make it so that I can circle (in many different ways) around the bounding box of a tagged item. Is this a good way of doing what I'm ...
3
votes
0answers
91 views

Creating collisions for a breakout style wall [closed]

I am creating a breakout style game as an introduction to JavaScript, and would like to know whether the way I have gone about doing this is efficient/viable. As well as needing assistance with ...
6
votes
1answer
75 views

Display text on video screen

The code displays a video that will play a video and then display some text on the screen at specific locations on the video screen. The code works but I would like to see if I could change ...
6
votes
1answer
101 views

Plan to make a small game - got a hang of canvas and made a cube fly around

I'm planning to make a small game for learning purposes. So far, I've got the hang of the canvas element and using the context to draw things on it, as well as object notation and classes in ...
4
votes
1answer
594 views

Bouncing ball in JavaScript

I have been using this code for a while for a project at work. Actually I got it from a friends who got it from a book. But either way it worked for my demonstration. But the other night I decided to ...
4
votes
2answers
344 views

Ping-pong game with JavaScript and Canvas

I have created my first ping-pong game with JavaScript and Canvas. I will be glad if anybody can tell me how to optimize the code and functionality. https://github.com/nikitalarionov/js-pong First ...
5
votes
1answer
453 views

Utilizing HTML5 Canvas to apply color theme to .png icons

Because we have a mix of both icons for core items and .png icons for custom items, I've developed an easy way to theme them (alter the color) all of them easily that will work across all browsers. ...
7
votes
2answers
485 views

Optimizing the performance of html5 video manipulation

I've been working on an html5 canvas video player with a lot of fun little extras and ui toys, the main one being a chroma key (green screen) effect that allows the user to key out different colors or ...
4
votes
2answers
253 views

JavaScript Tic-Tac-Toe review: best practices, correctness, and any other improvements/suggestions

I just finished a little game of Tic-Tac-Toe for a class I'm in, and I think it looks alright, but I'm pretty fresh, so I would like to know how I might be able to improve it, given the situation I'm ...
0
votes
1answer
169 views

Canvas performance and stable frames per second

I'm sure this has probably been asked before (although I couldn't find a question akin to this one). I have a canvas "app" that is refreshing persistently, but performance is awful on mobile devices. ...
4
votes
1answer
95 views

javascript canvas -javascript design

I am doing some tests with html5 Canvas object. At the same time I am trying to make my javascript code more modular. In the following code, where/how should I declare canvas and context, so that it ...
2
votes
1answer
300 views

Review a simple sprite sheet animation script

This is just a simple script for testing sprite sheet animations. I'm trying to improve my code style, so I'm curious about suggestions anyone might have about best practices or readability. ...
3
votes
1answer
109 views

Collision detection accuracy

How do you guys think I can improve the code for collision detection on my website asteroidfield.eu5.org? The current code is ...
2
votes
2answers
184 views

Javascript canvas interactive chart - how to make my code shorter

I'm trying to teach myself javascript and HTML5, (just beginning), and for some practice with canvas I am trying to turn this chart into an interactive chart on canvas, whereby clicking on a word ...
0
votes
1answer
154 views

Second attempt at canvas spatial grid collision

After posting my first question and my first attempt which you can see here: Canvas spatial grid collision I have re-written it to try and implement what the person gave as an answer. I didn't do ...
3
votes
1answer
192 views

Canvas spatial grid collision

You can see a working example here. Be sure to click on the canvas or the key inputs will not be detected! Are there any ways I could improve upon this? Anything that should have been done ...
3
votes
1answer
883 views

JavaScript/Canvas Pong game

This is the first time I've written JavaScript in this way (previously all I've done mostly is DOM manipulation and form validation in vanilla and jQuery). I've begun working on a basic Pong game. ...
5
votes
1answer
196 views

Basic game code structure tips

I'm learning JavaScript and came up with this basic game code structure (using the CreateJS framework): ...
5
votes
1answer
216 views

Optimize iterative pixel blending function

Summary I've created a function that blends tiles on a 2D hexagonal grid with their neighboring tiles based on an image that serves as a "blend mask". It runs, and isn't too intensive, but I feel it ...
6
votes
2answers
505 views

Splitting text into lines from a max width value for CANVAS

Ok so this works as is, and is not actually slow at all (from what I can see) - However I don't like the taste of nested while loops and was wondering if anyone could give some insight on a different ...
5
votes
2answers
720 views

Simple JavaScript canvas game

Here is a link to the code on JSFiddle. This is my first attempt at playing with canvas. Before I move on doing anything else, it would be nice to have insight from somebody who knows canvas and ...