Browsing articles tagged with

javascript

Ajax based streaming and progress monitor

Streaming (Comet) Streaming means to send content part by part at some intervals in the same request. Or in other words, the client is able to process the response part by part, instead of waiting for the whole transfer to complete. In the context of http and web applications it is more specifically called Comet. The wikipedia page defines it as Comet ...

Monitor progress of long running php scripts with html5 server sent events

Server sent events When running a long serverside task inside a web application it becomes very useful, if not necessary to report the progress of that task in realtime to the clientside, that is the browser. Earlier there was no easy way to do this and hacks had to be constructed to achieve such a realtime notification. Classical solutions include ajax ...

Make a rope using box2d in javascript

Rope In this experiment we shall make a rope like thing in box2d. There is no rope like structure that box2d supports directly. But if multiple small units are connected together at their edges using a revolutejoint, then it was act somewhat like a rope. Lets take a look You can move any part of the rope using your mouse. Now in this ...

Distance joint in box2d in javascript

Distance In the previous post on mouse joints we learned how to interact with box2d objects using the mouse. Now its time to take a look at another joint in box2d, the distance joint. Distance joint connects 2 bodies maintaining a fixed distance between them, its like metal wire connecting the 2 bodies, such that the wire would neither expand nor ...

Playing with the mouse joint in box2d in javascript

Mouse Joint Out of the many joints that box2d has, one is mouse joint. It is not used in physics simulations, but helps to make the physics world interactive by making a body move towards a specific point, like the mouse coordinates for example. So objects can be picked up, dragged etc by the user. Lets take an example Pickup an object by ...

Add custom functions to the html5 audio element for better functionality

Html5 Audio The html5 audio element provides a simple api to play sound files like mp3, ogg, wav etc. It can be created by putting an audio tag in the html or by creating an instance of the Audio object in javascript. Here is a quick example of using it from within javascript code. var aud = new Audio(); aud.src = 'path/to/song.ogg'; aud.play(); That much ...

Add a stop function to the html5 audio element

The Audio element of html5 does not yet have a stop function, but has a pause function. So here is a simple trick to add a stop function to your Audio elements by modifying the prototoype of the class. //Give the Audio element a stop function HTMLAudioElement.prototype.stop = function() { this.pause(); this.currentTime = 0.0; } The function would first pause the audio element, then would set the ...

Using the html5 audio element from javascript

Sometime back I was making a browser based game in the html5 canvas tag which had some audio too. The html5 audio tag is an easy option to add sound/music to any webpage. It can play variety of formats like wav, ogg and mp3. However format support itself varies across browsers. The audio element can be directly added to html in ...

Make a simple html5 game with box2d in javascript – tutorial

Demo First lets play the game that we shall be making in this tutorial. Its called Fruit Hunter. Tested on Chrome and Firefox. Click in the game then start using the arrow keys to control the monkey. Press the left, right and up arrow keys to make the monkey move and jump. Do not fall off the stands and try to ...

Validate file upload with html5 file api

The html5 file api provides lots of new features which can be used to read files on clientside from within the browser. Lets take a look at this Demo first : This file upload control will only take zip or png files which are less than 1MB in size. For any other files it will show an error message. And this functionality if ...

Pages:12»