Create your own interactive face mask by using Scratch Labs, where you can test exciting new features!
Make animated costumes and games that interact with your face. Explore a creative and safe introduction to machine learning by creating projects that respond to your eyes, nose, and other parts of your face.
What you’ll need to get started
- Computer with a modern browser and a webcam
- An internet connection
Step 1. Visit Scratch Online
Visit https://lab.scratch.mit.edu/face/ and then click try it out.
Make sure you click “Allow” when it asks for access to your camera.
Step 2. Quick Test
Drag in the block ‘when flag clicked go to nose’, this will make our sprite, which by default is Scratch the Cat, move to your nose whenever you click the flag, but only once.
To make it move their continuously, we need to put that block inside a ‘forever’. This makes the programme continuously look for your nose, and then move the sprite to wherever your nose is.
Step 3. Resize and Tilt
Currently, the sprite stays upright as we rotate and doesn’t change size depending on our distance from the camera. We can correct this by dragging in the two blocks ‘set size to face size’ and ‘point in direct of face tilt’.
Make sure you put these blocks inside the forever loop, or it’ll only do them once!
Step 3. Artwork
Excellent, now we have our code working lets customise what it looks like. Click on the costumes button in the top left and you’ll see two Scratch the Cat sprites.
Click the button at the bottom left and the artwork library will open up, where you can choose whatever artwork you like! Maybe a snazzy pair of classes or a funky hat? Have a scroll through the library and pick whatever you like.
Want to draw you own? Hover over that same button and then click the paint brush, this will give you a blank canvas where you can draw your own design.
Step 4. Next Steps
Now you’ve got an awesome interactive face mask, think about what you could do next. What else do you know in Scratch that you could combine with this? Could you make a ball bounce off your nose? Play a song by tilting your head side to side? Play with the face sensing blocks and create your own custom code!
Theres some great starter projects at the bottom of the Face Sensing Home Page you can use, so have a look their for inspiration.