Tuesday Nov 6th
- Introduction to object literals and JSON!
- Note, if you are using a local editor like atom and want your paths to point to online instances of p5, there are links to all the p5 files here.
- Read over the Object literal tutorial and do the exercises.
- Sign up to Github.
- Finish your Generative Landscape project
Thursday Nov 8th
- Generative Landscape projects due at the start of class. Ensure you have documented your work on this blog. Come ready to present and discuss.
- Homework:
- Please complete a mid term self assessment form here (this is worth 5% of your grade).
- Read the the Intro to JSON tutorial.
- Read this intro to text and typography tutorial.
- Research Post: Read Jer Thorps Art of the API article. Find an API and write about what it does in the context of this article. From the documentation write about what information the API’s lets you access. Can you think of information within the platform that exists but that it does not let you access? You might choose the Citibike API, NY Times API, https://dronestre.am/, one of the USGS APIs, one of these Space APIs, A world weather API, OpenStreetMaps API.
- Complete this pair programming exercises:
Exercises:
Explore Darius Kazemi’s github repository of corpora. (Fork it to your github account, see the fork button at the very top right). In the data folder are a great many lists (all in the JSON format) of different categories of things. Take a look around in there!
Github lets you access the raw data of any file it hosts, so if you go to a list you like, and click the raw button, you will see the raw json. You can use the url of this raw JSON in the loadJSON function.
eg. here is the raw JSON for a list of donkey breeds:
https://raw.githubusercontent.com/dariusk/corpora/master/data/animals/donkeys.json
Or laundry care instructions
https://raw.githubusercontent.com/dariusk/corpora/master/data/instructions/laundry_care.json
If you want to use one of these files, you could use these paths that link to the file as stored on Github or you might copy the data and put it in a local .json file. Use this repository ( or otherwise) and do the following exercise:
1. Navigating JSON:
Fork this sketch to your openProcessing and do the exercises at the bottom.
2. Joke generator:
Create a program that generates knock knock jokes. At a minimum your program should generate a random reply to “Who’s there?” and create the final line of the joke. Generate 10 jokes. Don’t forget to consider fonts, colors and layout.
- See the starter template here.
- Having trouble with getting a random index of an array in a JSON file? Take another look at the commented code at the bottom of this example.
- Need an overview of text and type? Reminder to read this fab tutorial by Allison Parrish.
Extension: Using Kazemi’s files, create program that generates a different style of text. eg. you might make a cocktail recipe generator, an emergency sign generator, a weather forecast generator, etc. etc.
You must be logged in to post a comment.