html5<canvas基础>
来源:互联网 发布:北邮网络远程教育 编辑:程序博客网 时间:2024/06/08 05:27
<!DOCTYPE html>
<html>
<head>
<style>
canvas{
background:#ccc;
}
</style>
<title>noTitle</title>
<meta charset="">
<link rel="stylesheet" href="">
<script>
window.onload=function () {
var canvas=document.getElementById("canvas");
var cobj=canvas.getContext("2d");
cobj.rect(0,0,100,100);
// var colorObj=cobj.createLinearGradient(0,0,100,0);
var colorObj=cobj.createRadialGradient(50,50,10,50,50,50);
// var imgObj=cobj.createPattern(document.getElementById("img"),"repeat-y")
colorObj.addColorStop(0,"red");
colorObj.addColorStop(0.5,"blue");
colorObj.addColorStop(1,"green");
cobj.shadowColor="rgb(11,25,9)";
cobj.shadowOffsetX=3;
cobj.shadowOffsetY=3;
cobj.shadowBlur =5;
// cobj.fillStyle=imgObj;
cobj.strokeStyle="green";
cobj.fillRect(0,0,100,100);
//cobj.strokeRect(100,100,100,100);
}
</script>
</head>
<body>
<canvas width=400 height=400 id="canvas">
你的浏览器out了
</canvas>
<img src="1.jpg" id="img">
</body>
<html>
<head>
<style>
canvas{
background:#ccc;
}
</style>
<title>noTitle</title>
<meta charset="">
<link rel="stylesheet" href="">
<script>
window.onload=function () {
var canvas=document.getElementById("canvas");
var cobj=canvas.getContext("2d");
cobj.rect(0,0,100,100);
// var colorObj=cobj.createLinearGradient(0,0,100,0);
var colorObj=cobj.createRadialGradient(50,50,10,50,50,50);
// var imgObj=cobj.createPattern(document.getElementById("img"),"repeat-y")
colorObj.addColorStop(0,"red");
colorObj.addColorStop(0.5,"blue");
colorObj.addColorStop(1,"green");
cobj.shadowColor="rgb(11,25,9)";
cobj.shadowOffsetX=3;
cobj.shadowOffsetY=3;
cobj.shadowBlur =5;
// cobj.fillStyle=imgObj;
cobj.strokeStyle="green";
cobj.fillRect(0,0,100,100);
//cobj.strokeRect(100,100,100,100);
}
</script>
</head>
<body>
<canvas width=400 height=400 id="canvas">
你的浏览器out了
</canvas>
<img src="1.jpg" id="img">
</body>
</html>
阅读全文
0 0
- html5<canvas基础>
- html5 canvas基础特性
- HTML5 Canvas 基础 一
- HTML5 Canvas 基础 二
- HTML5 canvas 基础入门教程
- html5 canvas基础用法
- html5 canvas基础
- HTML5 Canvas基础
- HTML5基础 --- Canvas元素
- html5 canvas 画布基础
- HTML5-Canvas绘图基础
- HTML5之canvas基础
- html5 Canvas基础
- HTML5 Canvas基础练习
- HTML5 canvas 基础
- html5-canvas基础API
- HTML5 之 Canvas --- 01、Canvas基础
- HTML5特性 > Canvas >基础绘图
- Android入门开发一个自动访问指定…
- VB.net窗体中调用项目内嵌HTML进行…
- Python 2.7使用豆瓣的pip镜像源
- 统计学习精要 (Elements of Statistical Learning ) 习题 5.10
- Windows下安装pycurl插件
- html5<canvas基础>
- Windows原版系统下载地址列表
- VB.net使用HTML解析组件HtmlAgilit…
- Maven的settings.xml文件结构之servers
- ubuntu 下update失败解决方法
- SQL Server2005下载地址
- Spring 怎样加载多个bean 配置文件
- 哈希表查找不成功的平均查找长度
- Hive serde 序列化表例子