MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
This shape generator tool can be used to define the coordinates and syntax for features that use {{cssxref("basic-shape")}}
The [coords](/en-US/docs/Web/HTML/Reference/Elements/area#coords) attribute of the {{HTMLElement("area")}} element
The CSS {{cssxref("basic-shape/inset()")}}, {{cssxref("basic-shape/xywh()")}}, {{cssxref("basic-shape/rect()")}}, {{cssxref("basic-shape/circle()")}}, {{cssxref("basic-shape/polygon()")}} functions
The SVG {{SVGElement("rect")}}, {{SVGElement("circle")}}, {{SVGElement("polygon")}} elements
The shape generator helps you visualize basic shapes, outputting the coordinates of each point, superimposed over your image. Upload an image by either dragging or clicking to select a file. Then select the type of shape you want to create from the dropdown menu. Optionally, you can also adjust the scale of the canvas using the range input. Then click on points on the image to add reference points for the shape you want to create. The tool will then output the markup for the HTML coords attribute value, CSS basic shape function with coordinates, and SVG shape.
html hidden live-sample___shape-generator
<fieldset>
<legend>Controls</legend>
<p>
<label for="scale">
Scale:
<input type="range" id="scale" min="0.1" max="3" value="1" step="any" />
</label>
</p>
<p>
<label for="shape">
Shape:
<select id="shape">
<option value="rect">Rectangle</option>
<option value="circle">Circle</option>
<option value="poly">Polygon</option>
<option value="points">Discrete points</option>
</select>
</label>
</p>
<p>
<button id="reset">Reset</button>
</p>
</fieldset>
<canvas id="canvas">Drop and image here, or click to upload.</canvas>
<p>
<output id="coords">Click on the canvas to add points.</output>
</p>