Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

1. Ordinateurs, art et pixels


Hi, this is Sarah! Welcome to day 6 of Scratch Art.

Last time, you learned about a conditional called the “if” statement.

Today, you will use another conditional called “if/else” to make a program that scans an image and makes a shadow. An “if” statement reads: if a condition happens, then do this action.

An “if/else” statement represents an either/or option. If the first condition is met, then it will do the first option. If the first condition is not met, or “else” it will do the second option.

For todays project, the shadow should be black if the picture is black, but otherwise, or else, something still needs to happen - the shadow should be white. An “if” alone wouldn’t allow for both options.

Pictures displayed on a computer screen are made up of millions of little squares called pixels. When the human eye takes in all these little squares together, it sees them as one complete picture.

Computers make it easy to change the look of a picture or photograph because they can manipulate each tiny pixel individually. Apps and photo editing tools like Instagram apply specific digital effects to photos using a process similar to the one you will use today.

Sometimes called filters, these effects include making photos black and white, altering the color scheme, or selectively changing portions of a photograph.

Editing tools like Photoshop can reduce redeye, make a background transparent, and sharpen images. The computer tests each pixel in the photo and changes it to create the different effects.

The if/else conditional statement allows computers to make these effects. In this example, the computer applies a “selective color” effect. It scans the color of each pixel. If the color matches the one it is programmed to to bring out, it keeps that color. Else, it greys out the color. In this picture, the program keeps the vibrant yellow color, while the other colors are greyed out.

These editing tools were created with computer science. Before these kinds of tools existed, artists had to painstakingly apply color to film or paint out mistakes. With computers, these corrections can be made instantly. In today’s project, you will program a filter that scans images to make silhouettes or shadows. Now, it’s your turn. Open the starter project, click remix, and sign in. Then, proceed to the next video.

Suivant arrow_forward
  1. Remixer le projet de démarrage.
  2. Connecte-toi à Scratch.