Cloudkick Viz is another HTML5 canvas tool. Built on HTML5, canvas, and JavaScript, it displays cloud server monitoring information when checking your servers. Servers are plotted in 3D space in real time on basis of performance metrics like CPU usage, Memory usage, and Ping latency. Each server will blink when monitoring data is updated, and if there is a check goes critical, it shakes and turns an angry red. What’s more, if you hover over a server, this canvas tool will show you its name and a ghost trail based on performance history. If you click it, you will get detailed monitoring data.
Posts tagged canvas
HTML5 Tool Of The Day – Harmony
Mr.Doob Harmony, an HTML5-based online tool, will let you draw on a white canvas using different brushes. It works best on Webkit, and you can save images to.png format. Harmony supports a very basic multiply blending effect (as seen in Photoshop). The developer said it’s the very first attempt to reproduce the functionalities of a drawing application after playing READ MORE »
Canvas Tutorial (Step Six) – Color Gradient
Besides CSS color parameters, fillStyle and strokeStyle can also be set as CanvasGradient objects. By using CanvasGradient parameter, we can define gradient color for lines and padding of figures. To create CanvasGradient object, we can use the following two methods: createLinearGradient and createRadialGradient.
Canvas Tutorial (Step Five) – Text Input
Although WebKit starts to support Text API with the several recent versions and FireFox also begins to support it with nightly build, I still decide to introduce Text API to you here.
Context object supports to set the following text properties:
font: text font, the same property of CSS font-family
textAlign: text horizontal alignment. The supported property values: start, end, left, right, and center. Start is set on by default.
Canvas Tutorial (Step Four) – Pixel Processing
2D Context API offers three methods to process pixel:createImageData, getImageData, and putImageData. ImageData objects memorize graphic pixel values. Each object contains three properties: width, height and data. Data property belongs to CanvasPixelArray category, which is used to save four values of widths and heights of graphics. And each pixel owns RGB value and Alpha value separately, and these two values may vary from 0 to 255! All the values will be saved and sorted left to right and top to down. In order to explain how it works better, let’s see a sample - draw a red rectangle.
// Create an ImageData object.
var imgd = context.createImageData(50,50);
var pix = imgd.data;
// Loop over each pixel and set a transparent red.
for (var i = 0; n = pix.length, i <
n; i += 4) {
pix[i ] = 255; // red channel
pix[i+3] = 127; // alpha channel
}
// Draw the ImageData object at the given (x,y) coordinates.
context.putImageData(imgd, 0,0);
Canvas Tutorial (Step Three) – Insert Image
Adopting drawImage allows you to insert images into canvas, including both img and canvas element. And you can even dram SVG figure in Opera, but the processes are relatively complicate, methods of invoking three, five or nine parameters separately are available for your option.
Three parameters: basic drawImage method. One parameter specifies figure’ location in web page, and the other two parameters define its position in canvas.
Five parameters: intermediate drawImage method. Besides the three parameters mentioned above, it contains other two parameters for specifying width and height of figure. (Use this method if you need to change figure’ dimension in future.)
Nine parameters: advanced drawImage method. It includes all five parameters above, and the other four parameters are used to set position, width as well as height of resource figure. There four parameters enable you to cut resource figure before displaying outcome figure in page.
Please preview sample of employing of these three methods. And the codes are recommended as follows:
// Three arguments: the element, destination (x,y) coordinates.
context.drawImage(img_elem, dx, dy);
// Five arguments: the element, destination (x,y) coordinates, and destination
// width and height (if you want to resize the source image).
context.drawImage(img_elem, dx, dy, dw, dh);
// Nine arguments: the element, source (x,y) coordinates, source width and
// height (for cropping), destination (x,y) coordinates, and destination width
// and height (resize).
context.drawImage(img_elem, sx, sy, sw, sh, dx, dy, dw, dh);
Canvas Tutorial (Step Two) – Draw Rectangle and Line
As we know that we can easily define rectangle’ padding and frames through fillStyle and strokeStyle properties. The method of using color value is the same for setting in CSS: Hex number system, rgb(), rgba() and hsla are supported. We can draw rectangle with padding using fillRect and draw rectangle with frames only using strokeRect. If you would like to clear parts of canvas, please adopt clearRect. All the methods above employ the same parameters: x, y, width and height. The first two parameters define coordinate and the latter two define rectangle’s width and height separately. And we can also set frame’ thickness using lineWidth. Please click here to preview sample with fillRect, strokeRect and clearRect used. Detailed codes recommended:
context.fillStyle = ‘#00f’; // blue
context.strokeStyle = ‘#f00′; // red
context.lineWidth = 4;
// Draw some rectangles.
context.fillRect (0, 0, 150, 50);
context.strokeRect(0, 60, 150, 50);
context.clearRect (30, 25, 90, 60);
context.strokeRect(30, 25, 90, 60);
Canvas Tutorial (Step One) – Canvas Basic
We have already known that HTML5 standard brings lots of new feature, and one of the most attractive factors is canvas element. HTML5 canvas provides a new method of drawing based on JavaScript, which makes painting much simpler but more powerful. Each canvas element contains its own “context” (We can understand it as one page on drawing table), in which we can paint any shape of figure as we like. Browsers support multiple contexts at the same time, and provide drawing feature through different API. Most of browsers now support 2D canvas context, including Opera, Firefox, Konqueror and Safari. Some versions of Opera support 3D canvas and Firefox realizes the same effect through widgets.
It’s quite easy to create canvas, you only need to add canvas element into your page as follows:
<canvas id=“myCanvas” width=“300″ height=“150″>
Fallback content, in case the browser does not support Canvas.
</canvas>



