Pen

Drawing Lines in OSL

Basics

Setting Pen States

  • Pen Down: Activates the pen to draw when moving.

    pen "down"
  • Pen Up: Deactivates the pen, so movement doesn’t draw.

    pen "up"

Customizing the Pen

  • Size: Sets the pen’s thickness.

    pen "size" [int]
    // Example: pen "size" 3
  • Opacity: Adjusts the line’s transparency (0-100).

    pen "opacity" [0-100]
    // Example: pen "opacity" 80
  • Brightness: Controls the line’s brightness (0-100).

    pen "brightness" [0-100]
    // Example: pen "brightness" 90

Rendering Lines

Basic Line

Draws a simple straight line.

c #fff  
pen "size" 3  
// Set the line color to white and size to 3.

goto 0 0  
line 50 0 -50 -50  
// Draw a line centered at (0, 0), starting at (50, 0) and ending at (-50, -50).

import "win-buttons"  
// Import the system's window buttons.

Dotted Line

Creates a line made of dots.

c #fff  
pen "size" 3  
// Set the dotted line color to white and size to 3.

goto 0 0  
dots -100 -100 100 100 30  
// Draw a dotted line from (-100, -100) to (100, 100) with 30 evenly spaced dots.

import "win-buttons"  
// Import the system's window buttons.

Striped Line

Creates a line made of alternating segments.

c #fff  
pen "size" 3  
// Set the striped line color to white and size to 3.

goto 0 0  
stripe -100 100 100 -100 10 5  
// Draw a striped line from (-100, 100) to (100, -100) with 10 segments and 5 units of spacing between them.

import "win-buttons"  
// Import the system's window buttons.

Last updated