热门关键字:
jquery > jquery教程 > jquery教程 > html5教程实现Photoshop渐变色效果

html5教程实现Photoshop渐变色效果

517
作者:管理员
发布时间:2021/3/17 10:29:43
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=4235
点评:html5教程实现Photoshop渐变色效果,大家参考使用吧




复制代码
代码如下:


<!DOCTYPE html><head>
<meta charset=utf-8>
<title>HTML5画线、圆、矩形</title>
<script src="<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script">http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script</a>>
</head>
<script>
$(document).ready(function(){
var c=document.getElementById("drawbox");
var draw=c.getContext("2d"); //获取2d内容的引用,调用绘图API</p><p>//指定渐变区块
var grd=draw.createLinearGradient(50,50,200,50); //坐标,长宽
grd.addColorStop(0,"black"); //起点颜色
grd.addColorStop(1,"green"); //终点颜色</p><p>draw.fillStyle=grd; //设为填充样式
draw.fillRect(50,50,200,50); //填充进矩形内
})
</script>
</body>
<canvas id="drawbox" width="500" height="500"></canvas>
</body>
</html>





如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:HTML
友荐云推荐