Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <canvas id="canvas" width="650" height="150" style="border: 1px solid black"></canvas>

	<input type="text" id="LinhaPontos" class="btn btn-info " size="80" value='[{"id":"1","x":40,"y":40,"radius":5,"color":"rgb(255,0,0)"},{"id":"2","x":100,"y":70,"radius":5,"color":"rgb(0,0,255)"},{"id":"3","x":160,"y":100,"radius":5,"color":"rgb(0,255,0)"}]' />

<input type="text" id="LPontos" size="80" value='' />


                body {
  margin: 0;
  padding: 0;


                const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

const px=400;
const py=40;
const eee = 'ola como vai==> ' + px;

document.getElementById("LPontos").value = '[{"id":"1","x":' + px + ',"y":40,"radius":5,"color":"rgb(255,0,0)"}]';

// Pega o conteudo da variavel "LinhaPontos" e converte em um Array de elementos
//const circles = JSON.parse(document.getElementById("LinhaPontos").value);
const circles = JSON.parse(document.getElementById("LPontos").value);

  circles.forEach(circle => {
  ctx.arc(circle.x, circle.y, circle.radius, 0, 2 * Math.PI, false);
  ctx.fillStyle = circle.color;

var bb = document.getElementById("LinhaPontos").value

// Converte o Array de elementos em um JSON para poder armazenar no Banco
var myJsonString = JSON.stringify(circles);

function isIntersect(point, circle) {
  return Math.sqrt((point.x-circle.x) ** 2 + (point.y - circle.y) ** 2) < circle.radius;

canvas.addEventListener('click', (e) => {
  const pos = {
    x: e.clientX,
    y: e.clientY
  var aa=0;
  circles.forEach(circle => {
    if (isIntersect(pos, circle)) {
      alert('click on circle: ' + + '=>'+ aa);