Code for practicing basic shapes in Processing Language:
Find below the code for obtaining the given picture.
Find below the code for obtaining the given picture.
//*********************************//
//Code For Practicing Basic Shapes
//Abhijith M S
//10-01-2024 - (Wednesday)
//*********************************//
// set the size of the canvas
size(800, 800);
// first, paint the background purple
background(208, 170, 208);
// set line color and width and fill color
stroke(246, 173, 113);
strokeWeight(2);
fill(113, 70, 132);
// draw the ellipse in center of canvas
//ellipse(width/2, height/2, 320, 320);
// draw line from position (21, 22) to position (31, 32)
//line(21,22, 31,32);
// draw triangle between position (210, 220),
// position (310, 320), and position (410, 220)
triangle(30,30,180,30,110,80);
// draw rectangle at position (50, 50) with
// size given by width 150 and height 150
rect(300, 30, 150, 150);
// the last argument is the corner radius
rect(600, 30, 150, 150, 10);
// draw rounded rectangle with (100, 300) as center
rectMode(CENTER);
fill(200,100,50);
rect(100,280, 150, 150);
rectMode(CORNER);
// draw the ellipse with gray colors
stroke(255, 255, 255);
strokeWeight(2);
//fill(180,180,180);
fill(180);
ellipse( 380, 280, 150, 150);
// draw the ellipse with blue with 50% transparency (0-255)
//ellipse below
ellipse( 650, 280, 80, 80);
//ellipse on top
fill(0,0,200,0.5*255);
ellipse( 650, 280, 150, 150);
//Mondrian Painting Recreated
//create a whitecolored background, that fits here
strokeWeight(0);
fill(255);
rect(50, 400, width-100, height-485);
// define blue, red and yellow
color blue = color(9, 37, 87);
color red = color(135, 3, 17);
color yellow = color(211, 179, 15);
strokeWeight(7);
//lines that fall below
stroke (red);
line (735, height-405, 735, height-85);
//horizontals
stroke (red);
line (50, height-400, width-50, height-400);
stroke (yellow);
line (50, height-385, width-50, height-385);
stroke (blue);
line (50, height-370, width-50, height-370);
//stroke (yellow);
//line (50, height-340, width-50, height-340);
stroke (blue);
line (50, height-300, width-50, height-300);
//stroke (yellow);
//line (50, height-285, width-50, height-285);
stroke (yellow);
line (50, height-220, width-50, height-220);
stroke (red);
line (50, height-205, width-50, height-205);
//stroke (yellow);
//line (50, height-160, width-50, height-160);
//stroke (yellow);
//line (50, height-145, width-50, height-145);
stroke (blue);
line (50, height-115, width-50, height-115);
stroke (yellow);
line (50, height-95, width-50, height-95);
//verticals
stroke (yellow);
line (80, height-405, 80, height-85);
//stroke (blue);
//line (95, height-405, 95, height-85);
stroke (yellow);
line (110, height-405, 110, height-85);
stroke (red);
line (170, height-405, 170, height-85);
stroke (yellow);
line (190, height-405, 190, height-85);
stroke (yellow);
line (250, height-405, 250, height-85);
stroke (yellow);
line (280, height-405, 280, height-85);
stroke (yellow);
line (300, height-405, 300, height-85);
stroke (yellow);
line (330, height-405, 330, height-85);
stroke (red);
line (340, height-405, 340, height-85);
stroke (yellow);
line (370, height-405, 370, height-85);
stroke (blue);
line (385, height-405, 385, height-85);
stroke (yellow);
line (400, height-405, 400, height-85);
stroke (red);
line (480, height-405, 480, height-85);
stroke (yellow);
line (500, height-405, 500, height-85);
stroke (yellow);
line (590, height-405, 590, height-85);
stroke (yellow);
line (635, height-405, 635, height-85);
stroke (yellow);
line (660, height-405, 660, height-85);
stroke (yellow);
line (720, height-405, 720, height-85);
//stroke (red);
//line (735, height-405, 735, height-85);
stroke (yellow);
line (750, height-405, 750, height-85);
//lines on top
stroke (yellow);
line (50, height-340, width-50, height-340);
stroke (blue);
line (95, height-405, 95, height-85);
stroke (yellow);
line (50, height-285, width-50, height-285);
stroke (yellow);
line (50, height-160, width-50, height-160);
stroke (yellow);
line (50, height-145, width-50, height-145);
save("FirstWork.png");