+ 2
How can we draw any curve in HTML?
How can we draw any curve in HTML?
8 Réponses
+ 3
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.moveTo(20,20); ctx.bezierCurveTo(20,100,200,100,200,20); ctx.stroke();
https://stackoverflow.com/questions/24381342/how-to-draw-a-gaussian-curve-using-canvas
+ 2
vaibhav i dont think we can draw any curve using path tag
+ 2
Error is showing in JS code
+ 2
this is the coding of a house and i wnt to make a path using JS code but there is an error "c.getContext is not a function " this is the error how will it b removed??
+ 1
you can use path tag
+ 1
ctx.bezierCurveTo(100,50,50,100,100,150);
ctx.quadraticCurveTo(100,50,200,100,100,150)
+ 1
<!DOCTYPE html>
<html>
</head>
<body>
<svg width="100%" height="480">
<path d="M 45 120 L70 80 L250 80
L270 120 L250 120 L250 200 L55 200 L55 120 L45 120 L 70 80 L100 120 L50 120 L250 120 L90 120 L90 200 L80 190
L80 130 L90 120 L55 120 L65 130 L65 190 L55 200 L55 120 Z"
fill=none stroke=green />
<path d="M 120 150 L150 150
L150 175 L120 175 L120 150 L130 150 L130 175 L 140 175 L140 150 L150 150 L 150 167 L120 167 L120 158 L150 158"
fill=blue stroke=green />
<path d="M 180 150 L210 150
L210 175 L180 175 L180 150 L190 150 L190 175 L 200 175 L200 150 L210 150 L210 158 L180 158 L210 158 L 210 167 L180 167"
fill=blue stroke=green />
<path d="M 130 152 L140 156 L140 158 L130 158 Z"
fill=blue stroke=green />
<path d="M 55 120 L65 130 L65 190 L55 200 "
fill=brown stroke=red />
<path d="M 90 120 L80 130 L80 190 L80 190 L90 200"