Home  >  Article  >  Web Front-end  >  javascript CSS drawing basics_javascript skills

javascript CSS drawing basics_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:49:121302browse

First, the style of the graphic display, that is, the color, transparency, etc. of the graphic; second, the algorithm, that is, the appearance of the graphic, which is a simple line, rectangle, circle, sector, polygon, etc. JavaScript and CSS are undoubtedly the best partners, all The most basic element of vector graphics is a 1*1px point, which can be formed into a line, a surface, or any shape.
The basis of all vector graphics____1*1px point
If you have a certain understanding of CSS and are familiar with clip:rect(top,right,bottom,left), you can know that the code clips an area. It should be noted that the positions of the four sides in clip:rect are relative to the object and not to the window. In addition, the position must be absolute here.

Can be drawn Draw a red dot
The fundamental reason why the algorithm can form a picture is to draw a point at a specific position
Use the left and top of css to draw a picture at a specific position, and the root cause of realizing the algorithm into a visible figure can be solved, as follows This code can draw a 1*1px red dot at the coordinate position of (100,100)
Copy code The code is as follows:
function _mkDiv(x, y, w, h,color)
{
'
';
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn