Home > Web Front-end > H5 Tutorial > HTML5 tutorial to achieve Photoshop gradient effect_html5 tutorial skills

HTML5 tutorial to achieve Photoshop gradient effect_html5 tutorial skills

WBOY
Release: 2016-05-16 15:48:37
Original
1848 people have browsed it


Copy code
The code is as follows:


HTML5 line, circle, rectangle drawing

<script><br>$(document).ready(function(){<br>var c=document.getElementById("drawbox");<br>var draw=c.getContext("2d"); //Get a reference to the 2d content and call the drawing API</p> <p>//Specify gradient block<br>var grd=draw.createLinearGradient(50,50,200,50); //Coordinates, length and width<br>grd.addColorStop(0,"black"); //Start point Color<br>grd.addColorStop(1,"green"); //End color</p> <p>draw.fillStyle=grd; //Set as fill style<br>draw.fillRect(50,50,200,50); //Fill into the rectangle<br>})<br></script>





Rendering:

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template