HTML5 Canvas high-fidelity 3D fabric effects, html5canvas
The HTML5 specification introduces many new features. One of the most promising features is the Canvas Element.JavaScriptThe method of drawing a graph is very powerful. Next we will share with you the effect of a 3D cloth pattern drawn by HTML5 Canvas.
Tip: to ensure the best results, visit modern browsers such as IE10 +, Chrome, Firefox, and Safari.
Demo of plug-in download Effect
Articles you may be interested in
- 10 useful results in Web development [Source Code download]
- Excellent jQuery Ajax paging plug-ins and tutorials carefully selected
- 12 amazing creative 404 error page Designs
- Let the website get started! 12 excellent jQuery animation plug-ins
- Amazing 8 HTML5 & JavaScript Special Effects
Link to this article: HTML5 Canvas highly imitation and Realistic 3D cloth pattern effect
Source: Dream sky ◆ focus on front-end development technology ◆ share web design resources
Whether html5 canvas is a bitmap or a vector image
The image drawn by canvas is a bitmap.
Do a test: Use canvas to draw a simple image, and then enlarge the webpage. You will see that the image and text in the canvas will be distorted (one point will become larger)
<Html>
<Head>
<Title>
Canvas Example
</Title>
<Script type = "text/javascript">
Function loader (){
Var canvas = document. getElementById ('canvas ');
Var canvas1 = canvas. getContext ('2d ');
// Rectangles
Canvas1.fillStyle = "rgba (0, 0,200, 1 )";
Canvas1.fillRect (30, 30, 75, 70 );
Canvas1.font = 'italic 40px sans-serif ';
Canvas1.strokeText ("Hello! ", 50, 50 );
}
</Script>
</Head>
<Body onload = "loader ()">
<H1> Canvas Example <Canvas id = "canvas" width = "300" height = "300">
</Canvas>
</Body>
</Html>
Html5 canvas Problems
The reason is that your browser card and image are not read. Wait a while, or use the code I wrote.
<! Doctype html>
<Html>
<Body>
<Head>
<Canvas id = "myCanvas" width = "200" height = "100" style = "border: 1px solid # c3c3c3;">
Your browser does not support the canvas element.
</Canvas>
<Script type = "text/javascript">
Window. onload = function (){
Var c = document. getElementById ("myCanvas ");
Var cxt = c. getContext ("2d ");
Var img = new Image ();
Img. src = "www.w3school.com.cn/ I /eg_flower.png ";
Cxt. drawImage (img, 0, 0 );
}
</Script>
</Head>
</Body>
</Html>