Search the Community
Showing results for tags 'canvas'.
-
Hi, I have been working on a side scrolling shooter for the past couple of weeks and I would like to get some testing done. The game is similar in style to many retro shooters like Gradius, UN Squadron etc. The game play is a simple wave style, where you complete a level that has certain groups of enemies come at you in different patterns/amounts. This version only contains 1 level and is quite short to help with debugging and testing. Let me know what you think and if there are any issues that you can see. The graphics are basic atm, I will be getting better ones made once the games mechanics are stable. Thanks http://cjmarkham.co.uk/projects/canvas-shooter-2 http://cjmarkham.co.uk/projects/canvas-shooter-2/php_freaks.txt
-
Seriously, HTML 5 Canvas really lacks functionality. I searched how to clear a text written on it, and all what I am getting is to clear the whole damn canvas. Moreover, clearing all itself is not working. Here are my codes: HTML <img src="jjj.jpg" width="252" height="144" id="image"> <canvas id="canvas" width="252" height="144"></canvas> <input type="button" onclick=" insertImg ();"> <input type="text" id="text"/> <input type="button" onclick="writeText();"> <input type="button" value="Clear" onclick="clearCanvas();"> Javascript //Draw image function insertImg () { var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var image = document.getElementById("image"); context.drawImage(image, 0, 0); } //Write text function writeText () { var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var style = 'italic'; var size = '50pt'; var family = '"Arial Black", Gadget, sans-serif' var text = document.getElementById("text").value; context.font = style + " " + size + " " + family; context.fillStyle = 'blue'; context.fillText(text, 50, 50); } //Clear canvas function clearCanvas () { context.clearRect(0, 0, 252, 144); } Everything is working correctly, except, the canvas is not clearing when I click on the clear button. I will be glad if we can clear the text also separately from clearing canvas as a whole.
-
Hi, I have an IFrame. Good. And I have a Canvas as well. Good again! The user can write on the IFrame as I set the design mode ON. I am using document.execcomand to do the stuff, just like a simple text editor. I do not have issues on this. Here are my questions: 1/ What I want is, how to make the text written in the IFrame, appears on the Canvas? I mean, when the user is typing in the IFrame, the text is appearing simultaneously on the Canvas. If the user changes the text color, font color, bold, italic or whatever, of course the text also changes on the Canvas simultaneously. How to do that? 2/ Can I make all the elements draggable and resizable in the Canvas? I mean the text or anything but NOT the canvas? Help!
-
Well, I am planning to make something complex. Ok, I still have not done it but I want to know how to proceed to do it. Suppose there is a Canvas, and I am dragging and dropping images in it which can resize. The issue is not on the drag/drop and resize stuffs. What I want is, once an image is in the Canvas, how to write on it by double click? I mean if I double click, the cursor turn to text and people can write. How to proceed to do this? The canvas will be saved in image format later. All I want to know now, is this writing stuff, the rest I do not care too much now! Thank
-
- html5
- javascript
-
(and 1 more)
Tagged with: