Unit 1: Day 8
Tasks
8.1 Review Data Concepts with the AP Explore Teachers Resource
- The AP Explore Teachers Resource requires an official AP account. You can create an account here.
- Complete the Data Collection Devices and Data Types Reference to review and expand on the data types discussion from last class
- The Classifying Data sheet may also be useful
8.2 What is Metadata?
- Last class, we introduced types of images. Although it is not a programming concept, it is good time to talk about the Metadata that is stored in our images and other files:
- Watch the video 5 Minute Metadata: What is Metadata [3:55]
- Be sure to emphasize the following AP CSP Essential Knowledge Statements:
- Metadata are data about data. For example, the piece of data may be an image, while the metadata may include the date of creation or the file size of the image.
- Changes and deletions made to metadata do not change the primary data.
- Metadata are used for finding, organizing, and managing information.
- Metadata can increase the effective use of data or data sets by providing additional information.
- Metadata allow data to be structured and organized.
- Have students open up an image in Photoshop. What metadata can they find?
- 1 minute research - have them look up what metadata is part of a tweet, snap message or other social networking communication. Then share what they found with a neighbour.
8.3 Introduction to Image Editing
- If you have access to image editing software such as Photoshop, take some time to teach students to edit images (remove backgrounds, resize, etc) to allow for more interesting looking projects in the future.
8.4 Images Example - Skull
- This fun example should be demonstrated to the students before starting the code so they know where you are heading.
- Normally I do this with politicians but I will always adapt the politician to the mood of the room.
- Once they see where you are going, let them find their own pictures. The only requirement is that both the before and after pictures need to be looking straight ahead.
- This example introduces the Mod or Modulus operator % as a different way of looping a variable.
- AAP-2.C.2 The exam reference sheet provides a MOD b, which evaluates to the remainder when a is divided by b.Assume that a is an integer greater than or equal to 0 and b is an integer greater than 0.For example, 17 MOD 5 evaluates to 2
Unit 1 - Example 8 - Skull
This example requires fonts and images to be uploaded separately.
let first, second;
let transparency = 255;
function preload(){
first = loadImage("insert first image name here e.g., mcdavid.jpg");
second = loadImage("insert second image name here e.g., skull.jpg");
}//end preload
function setup() {
let sketch = createCanvas(400, 300);
sketch.parent("mycanvas");
imageMode(CENTER);
}//end setup
function draw() {
background(0);
tint(255,255);
image(second, 188,75, 350, 500);
tint(255, transparency);
image(first, 200,150,400,300);
transparency-=10;
if(transparency < 1){
transparency = 255;
}
}//end draw
function mousePressed(){
transparency -= 5;
transparency = transparency%255
}//end mouse
8.5 Use of images
- As students search for images to use, ask them “If you were to release your program publicly, are you allowed to use any images you find.”
- Images and any created work fall under “copyright.” Use of any material, other than privately (for your own private use) is subject to copyright rules.
- Many materials are made available for legal use (free or paid) based on their license.
- Creative Commons - allows use as long as the source is given (Wikipedia uses it a lot).
- IOC-1.F.7: Creative commons, open source, and open access have enabled broad access to digital information.
- When using resources (images, code, text) from other sources, you must be aware of the license they are under.
Continue to Unit 1: Day 9 »