dot

Category:Turtle

dot(radius)

Category: Turtle

Draws a dot centered at the turtle's location with the specified radius.

Drawing a dot is one of the ways to draw with the turtle. There are many things you can draw with just dots and lines, along with the ability to change the pen color, line thickness and dot radius.

Examples


//  Draw a 5 pixel radius dot.
dot(5);

Example: Large Dot Draw a really big dot.

// Draw a really big dot.
dot(150);

Example: Fill the Screen Draw a huge dot to change the color of the entire screen.

// Draw a huge dot to change the color of the entire screen.
penColor("red");
dot(300);

Example: Mickey Mouse Draw Mickey Mouse with three dots.

// Draw Mickey Mouse with three dots.
penUp();
dot(100);
moveForward(125);
turnLeft();
moveForward(75);
dot(50);
turnLeft(180);
moveForward(150);
dot(50);

Example: Dalmatian Draw a lot of random sized dots at random locations.

// Draw a lot of random sized dots at random locations.
penUp();
for (var i = 0; i < 500; i++) {
  moveTo(randomNumber(0,320), randomNumber(0,450));
  dot(randomNumber(1, 10));
}

Syntax

dot(radius);

Parameters

Name Type Required? Description
radius number Yes The radius (in pixels, greater than zero) of the dot to draw

Returns

No return value. Outputs to the display only.

Tips

  • When drawing small dots, make sure you move or hide the turtle so you can actually see them.
  • Draw a huge dot to color the screen all one color.

Found a bug in the documentation? Let us know at documentation@code.org

Found a bug in the documentation? Let us know at documentation@code.org