Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

p5.js | strokeCap() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The strokeCap() function in p5.js is used to set the style of line endings. The ends of line can be rounded, squared or extended based on their parameters SQUARE, PROJECT, and ROUND. The default value is ROUND.


strokeCap( cap )

Parameters: This function accepts single parameter cap which holds the style of end of line (ROUND, SQUARE or PROJECT).

Example: This example shows all the different kinds of line ending edges.

function setup() {
    // Create canvas of given size
    createCanvas(400, 400);
function draw() {
    // Set the background color
    // Set the weight of line stroke
    // Set the color of line stroke
    stroke(20, 250, 100);
    // Set different edges style
    line(100, 200, 300, 200);
    line(100, 100, 300, 100);
    line(100, 300, 300, 300);



My Personal Notes arrow_drop_up
Last Updated : 05 Sep, 2019
Like Article
Save Article
Similar Reads
Related Tutorials