Html5

Positioning of HTML Content

Positioning of HTML Content

Fadıl

Positioning an HTML block in a web document is known as a layer. A layer can be created in two ways :

  1. Javascript positioning
  2. CSS positioning

Javascript creates a layer object for each layer that is defined. Using the layer object you can write Javascript code to move, hide, expand, contract, and change the overlapping sequence of layers. Even new layers and the content of existing layers can be changed dynamically. Dynamic animations and self-modifying pages are also possible.

Why JavaScript is better than HTML?

Why JavaScript is better than HTML?

Fadıl

For the beginners, the words JavaScript and HTML are simply terms that he/she has probably heard about. So, presuming that a few of these beginners are scanning this article, let’s begin with the definition of these words. HTML means Hypertext Markup Language that is, the tags accustomed to structure web pages to ensure that a browser may display it in a manner that is also influenced by the browser’s design and also the user’s preferences with regard to font, style, and so on. At the same time, JavaScript is “a scripting programminglanguage most often used to include interactive features as well as web pages”.

Translating – A canvas feature

Translating – A canvas feature

Fadıl

Translate is one of the canvas transformation methods. This method is used to shift the canvas and its origin point to various points in the matrix.

translate(x, y)

This method will take two arguments where the variable x denotes the movement of the element left or right and they variable denotes the movement of the element up or down. It is a good practice to save the canvas states they can be invoked when there is necessary to be called once again.

Clipping paths

Clipping paths

Fadıl

Clipping an area is just like normal canvas shape it helps in masking the unnecessary parts of the shapes. The image towards the right showcases a masked image. The star which is red in color will be used to clip through the surface .what ever the area that falls outside this clipping area will not be displayed.

In this post, we will discuss the clipping paths using the canvas clip() method.

Rotating -Canvas Transformation method

Rotating -Canvas Transformation method

Fadıl

In the previous post, we discussed the canvas  translation method and now in this post, we will discuss another transformation method rotate. Using the rotate method we can rotate the canvas element around the origin.

Rotate

This method takes an angle as the parameter and the canvas element is rotated about this angle. This is shown in the figure below.

The rotation point is the origin of the canvas. In order to change the center point, we have to use the translate method.