window.onload = function() {

    var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); context.beginPath();
context.moveTo(0,300); for(var x = 1; x < 300; x++){
var y = 300 + Math.sin(x * 0.02) *100;
context.lineTo(x,y);
} context.stroke();
};

quadraticCurveTo() & bezierCurveTo():

 

window.onload = function() {

    var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); var p0 = {
x: Math.random() * 600,
y: Math.random() * 600
}; var p1 = {
x: Math.random() * 600,
y: Math.random() * 600
}; var p2 = {
x: Math.random() * 600,
y: Math.random() * 600
}; context.beginPath();
context.moveTo(p0.x, p0.y);
context.quadraticCurveTo(p1.x, p1.y, p2.x, p2.y);
context.stroke();
context.closePath(); drawPoint(p0);
drawPoint(p1);
drawPoint(p2); function drawPoint(p) {
context.fillRect(p.x - 4, p.y - 4, 8, 8);
} };

window.onload = function() {

    var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); var p0 = {
x: Math.random() * 600,
y: Math.random() * 600
}; var p1 = {
x: Math.random() * 600,
y: Math.random() * 600
}; var p2 = {
x: Math.random() * 600,
y: Math.random() * 600
}; var p3 = {
x: Math.random() * 600,
y: Math.random() * 600
}; context.beginPath();
context.moveTo(p0.x, p0.y);
context.bezierCurveTo( p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
context.stroke();
context.closePath(); drawPoint(p0);
drawPoint(p1);
drawPoint(p2);
drawPoint(p3); function drawPoint(p) {
context.fillRect(p.x - 4, p.y - 4, 8, 8);
} };

window.onload = function() {

    var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); context.beginPath();
context.arc(200,200,100,0,2);
context.stroke();
context.closePath(); context.beginPath();
context.arc(400,400,100,0,2, true);
context.stroke();
context.closePath(); };

window.onload = function() {

    var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"); context.beginPath();
context.arc(300,300,100,0, Math.PI * 2);
context.stroke();
context.closePath(); };

[Javascript] Drawing Paths - Curves and Arcs的更多相关文章

  1. [Javascript] Drawing Paths - Lines and Rectangles

    <!DOCTYPE html> <html> <head> <meta name="description" content=" ...

  2. JavaScript Learning Paths(ES5/ES6/ES-Next)

    JavaScript Learning Paths(ES5/ES6/ES-Next) JavaScript Expert refs https://developer.mozilla.org/en-U ...

  3. [Javascript] Drawing Styles on HTML5 Canvas

    window.onload = function() { var canvas = document.getElementById("canvas"), context = can ...

  4. 【Javascript】js图形编辑器库介绍

    10个JavaScript库绘制自己的图表 jopen 2015-04-06 18:18:38 • 发布 摘要:10个JavaScript库绘制自己的图表 JointJS JointJS is a J ...

  5. HTML5资料

    1 Canvas教程 <canvas>是一个新的用于通过脚本(通常是JavaScript)绘图的HTML元素.例如,他可以用于绘图.制作图片的组合或者简单的动画(当然并不那么简单).It ...

  6. leaflet地图库

    an open-source JavaScript libraryfor mobile-friendly interactive maps Overview Tutorials Docs Downlo ...

  7. GDI+ Tutorial for Beginners

    原文 GDI+ Tutorial for Beginners GDI+ is next evolution of GDI. Using GDI objects in earlier versions ...

  8. IGeometryCollection Interface

    Come from ArcGIS Online IGeometryCollection Interface Provides access to members that can be used fo ...

  9. HTML <canvas> 学习笔记

    Professional JavaScript for Web Developers    P552 Basic Usage The <canvas> element requires a ...

随机推荐

  1. HDOJ多校联合第四场

    B题: C题:仅由'A','G','C','T',4个字母组成,给定一个字符串S,|S|<=15,给定一个整数m,以m为长度且仅含4种字母的字符串T,求LCS(S,T)为0,1,2,3....| ...

  2. [jobdu]不用加减乘除做加法

    使用异或和与,模拟机器的加法.http://blog.csdn.net/htyurencaotang/article/details/11125415 #include <iostream> ...

  3. [wikioi]均分纸牌

    这是一道归为贪心题...http://wikioi.com/problem/1098/ 参考:http://www.cnblogs.com/taoziwel/articles/1859984.html ...

  4. 《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立

    原文:<ArcGIS Engine+C#实例开发教程>第一讲桌面GIS应用程序框架的建立 摘要:本讲主要是使用MapControl.PageLayoutControl.ToolbarCon ...

  5. 在Hadoop伪分布式模式下安装Hbase

    安装环境:Hadoop 1.2.0, Java 1.7.0_21 1.下载/解压 在hbase官网上选择自己要下的hbase版本,我选择的是hbase-0.94.8. 下载后解压到/usr/local ...

  6. net中System.Security.Cryptography 命名空间 下的加密算法

    .net中System.Security.Cryptography命名空间 在.NETFramework出现之前,如果我们需要进行加密的话,我们只有各种较底层的技术可以选择,如 Microsoft C ...

  7. Android开发之PendingIntent的使用

    PendingIntent,待确定的意图,等待的意图 官网链接:http://developer.android.com/reference/android/app/PendingIntent.htm ...

  8. WinForm触摸屏程序功能界面长时间不操作自动关闭回到主界面 z

    操作者经常会在执行了某操作后,没有返还主界面就结束了操作然后离开了,程序应该关闭功能窗体自动回到主界面方便下一位操作者操作.那么对于WinForm程序怎么实现呢? 实现原理:拦截Application ...

  9. STL总结之functor

    STL中仿函数是重要的组成部分.所谓的仿函数就是通过重载括号运算符实现的, 如下: STL库中都是泛型仿函数如小于操作: STL中定义了许多有用的操作,如less(小于), less_equal(小于 ...

  10. [转]ASP.NET MVC 入门9、Action Filter 与 内置的Filter实现(介绍)

    有时候你想在调用action方法之前或者action方法之后处理一些逻辑,为了支持这个,ASP.NET MVC允许你创建action过滤器.Action过滤器是自定义的Attributes,用来标记添 ...