Post Page Advertisement [Top]

Computer ScienceScratchzlatest

Creating a Drawing Application in Scratch

This tutorial is based on a legacy tutorial from Scratch 2.0. (Scratch 101: Creating a Paint Program Part 1 and Part 2). If you are interested in adding a hardware component to this lesson, check out the this tutorial on how to make a capacitative stylus.

Objective: Learn how to utilize the "pen" extension within Scratch to create an interactive whiteboard utilizing loops, conditionals and sensing.

Final Product:


Graphical Template: https://scratch.mit.edu/projects/138943087/ (the "see inside" button will pull up the programming interface).

You will also need to add in the paint extension (see the following two step process):

Extension addition button
Select the "Extension addition" button
pen extension selection Scratch
Select the pen extension.
Scripts:
Paintbrush Scripts Scratch
Painting Scripts in Scratch (creates the paintbrush)
Once you have the first script programmed, you can give your project a try to see whether you are able to write on the screen. Then you can add in some more advanced features with the scripts below.

Some more advanced pen features (eraser, thickness, etc.)
Notice that the first script still contains your paintbrush with a few minor reset additions at the top of the script. The other two scripts add in five buttons to your program: e, p, c, d, 1 | These function in the following ways:

e: switches to "eraser" mode

p: switches to "painting mode"

c: erases everything on your screen

s: changes pen saturation by ten (i.e. color change)

1: increases pen size by one (i.e. makes your strokes thicker)

Extension: Test out some of the other features within the pen extension and see how they affect your painting program!

Integrating with the Stylus: This tutorial fits in well with the stylus tutorial. Once you have completed the steps detailed in the paragraph below, you will have programmed a painting application for your digital stylus.

If you have a Scratch account, you can save your project by clicking the remix button on the top bar. Once you have saved the project to your own account you can share it to your profile by clicking the "share" button.

On your touchscreen device navigate to the following link: https://scratch.mit.edu/users/YourScratchUserNameHere/ replacing "YourScratchUserNameHere" with your scratch username. Click on the shared painting application. Press the Green Flag and enjoy the use of your self-made digital stylus in your own self-made painting application!

Completed Program: Link


No comments:

Post a Comment

| Designed by Colorlib