background preloader

HTML5 et canvas

Facebook Twitter

Creating pseudo 3D games with HTML 5 canvas and raycasting - Ope. By Jacob Seidelin Note that there is a Czech translation of this article available - Jak vytvořit pseudo 3D hry v HTML5 canvasu s raycastingem - translated by Martin Hassman. Introduction With the increase in browser performance in recent times it has become easier to implement games in JavaScript beyond simple games like Tic-Tac-Toe.

We no longer need to use Flash to do cool effects and, with the advent of the HTML5 Canvas element, creating snazzy looking web games and dynamic graphics is easier than ever before. One game, or game engine, I wanted to implement for some time was a psuedo-3D engine such as the one used in the old Wolfenstein 3D game by iD Software. In this article, I'll deconstruct the latter project and go through the details of how to create your own pseudo-3D raycasting engine.

The article assumes a decent level of experience with JavaScript, familiarity with the HTML5 canvas element and at least a basic understanding of trigonometry. The map Ok, so far so good. Creating pseudo 3D games with HTML 5 canvas and raycasting: Part. By Jacob Seidelin Introduction This is my second article about creating Wolfenstein-like games with JavaScript, DOM and HTML 5 canvas; the techniques discussed are similar to those used in my WolfenFlickr project. In the first article, I created a basic map for the player to walk around in and a pseudo-3D rendering of the game world using raycasting techniques. In this article I'm first going to improve on the codebase I've already built, optimizing the rendering process to gain better performance and making the collision detection between the player and the walls better. In the second half, I'll implement static sprites to give the castle a bit of atmosphere and finally add an enemy or two. The final game example looks like this: The full (MIT licensed) sample code is available for download here.

Optimizing Without further ado, let's get on with optimizing the existing code base. Splitting the rendering and the game logic Optimizing the rendering Try the new optimized demo now. Sprites Enemies. HTML5 Canvas Cheat Sheet. There are cheat sheets for just about anything out there but I couldn't find one for the HTML5 canvas element, so I decided to do something about that, mostly for my own sake but if other people find it useful that's just all the better. The information is pretty much just a copy of what is found in the WHATWG specs, just condensed and hopefully a bit easier to read. There are virtually no explanations, however, and no examples other than some graphics for compositing values and a few other things (the appearance of which is very much inspired by those found in Mozilla's examples). So, it's basically just a listing of the attributes and methods of the canvas element and the 2d drawing context.

Choose between a 2 page PDF document or a PNG file. Thanks! Corrections and comments are welcome! Tutoriel canvas - MDC. Canvas - MDC. <canvas> est un nouvel élément HTML servant au dessin via des scripts JavaScript. Il peut être utilisé par exemple pour l'affichage de graphes, d'animations, ou de jeux vidéo. <canvas> a été introduit initialement par Apple pour le Dashboard de Mac OS X et ensuite implémenté dans Safari. Les navigateurs basés sur Gecko supportent ce nouvel élément depuis Gecko 1.8. (c'est-à-dire Firefox 1.5 et ultérieurs). L'élément <canvas> fait partie de la spécification Web applications 1.0 du WhatWG également appelée HTML 5.

Étiquettes et contributeurs liés au document Contributeurs à cette page :etienne-gauvin, emersion, Laurent_Lyaudet, Delapouite, tregagnon, ethertank, openjck, teoli, dextra, Mgjbot, BenoitL, Chbok. Dessiner avec canvas - MDC. Introduction Depuis Firefox 1.5, Firefox comprend un nouvel élément HTML servant à dessiner programmatiquement. L'élément <canvas> est basé sur la spécification canvas du WHATWG, elle-même basée sur la balise <canvas> d'Apple implémentée dans Safari. Celui-ci peut être utilisé pour afficher des graphes, des élements d'interface, et d'autres éléments graphiques personnalisés sur le client.

<canvas> crée une surface de dessin de taille fixe, ou canevas, exposant un ou plusieurs contextes de rendu. Le contexte de rendu 2D Un exemple simple Pour commencer, voici un exemple simple qui dessine deux rectangles ayant une intersection, l'un d'entre-eux possédant une transparence alpha : La fonction draw récupère l'élément canvas, et ensuite son contexte 2d. Les appels à fillRect, strokeRect et clearRect affichent un rectangle plein, surligné ou vide. Utilisation de chemins L'appel à fill() ou stroke() provoque l'utilisation du chemin. État graphique Un exemple plus compliqué Balise </canvas> requise. Woff fonts. This is a test for Gentium Basic repackaged in WOFF format. For extra variety, we also show Konstytucyja and DeLarge, both obtained from the Open Font Library site. For more information, see the WOFF format description. To convert existing TrueType/OpenType fonts to WOFF format (subject to appropriate licensing), there is a simple command-line tool sfnt2woff.

Precompiled versions for Mac OS X and for Windows are available. A zip file containing the format description together with sample code, including the source for the sfnt2woff tool, is available for download here. Support for this WOFF format is implemented in the latest nightly builds of Firefox (development builds with the name Minefield), and is expected to ship in Firefox 3.6. HTML5 Boilerplate - A rock-solid default template for HTML5 awesome. Initializr - Start your HTML5 project in 15 seconds!

Modernizr. Mobile Boilerplate. HTML EMAIL BOILERPLATE v 0.4 updated 5/12. Mgeraci/Less-Boilerplate. .gradientV4(#F2F1CB, #F0CED6, 33, #CED3F0, 66, #D2F0CE); hover to see compiled code background: #e2f1cd; background-image: -moz-linear-gradient(top, #f2f1cb, #f0ced6 33%, #ced3f0 66%, #d2f0ce); background-image: -webkit-gradient(linear, left top, left bottom, from(#f2f1cb), color-stop(0.33, #f0ced6), color-stop(0.66, #ced3f0), to(#d2f0ce)); background-image: -webkit-linear-gradient(top, from(#f2f1cb), color-stop(0.33, #f0ced6), color-stop(0.66, #ced3f0), to(#d2f0ce)); background-image: -o-linear-gradient(top, #f2f1cb 0%, #f0ced6 33%, #ced3f0 66%, #d2f0ce 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#f2f1cb, endColorstr=#d2f0ce); -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#f2f1cb, endColorstr=#d2f0ce); background-image: linear-gradient(top, #f2f1cb 0%, #f0ced6 33%, #ced3f0 66%, #d2f0ce 100%); .gradientH4(#F2F1CB, #F0CED6, 33, #CED3F0, 66, #D2F0CE);

Normalize CSS : necolas/normalize.css @ GitHub. Yepnope.js | A Conditional Loader For Your Polyfills! Layer Styles. Ligature-js - JavaScript to convert text patterns into common typographic ligatures. Bookmarkleter. Bookmarklet Crunchinator. Spritemapper.