Learn to Program with ZedLX

Free Online Programming Course for Beginners

Simple Graphics [15/15]

This program draws a triangle consisting of spaced lines, creating a slight moiré pattern (mwoa-RAY pattern).
[Run the program]

Exercises:

1. What happens when you change the last argument (the number 650) of the line procedure call? Try out different values, such as 400, 200, 0, and 500.

2. What happens when you change the second argument of the line procedure call? Try out different values between 0 and 700.

Simple Graphics - upside-down triangle task


3. Change the program so that the triangle of lines is displayed upside-down.

Solution

    line(450, 650, x, 100);

Loading...