Hello
13 |Hello
21 |├── .gitignore ├── README.md ├── archive ├── 01-html │ ├── article.html │ ├── basic.html │ ├── css │ │ └── style1.css │ ├── html-css-the-works.html │ ├── img │ │ └── cat_with_calculator.jpg │ ├── in-class-nov3 │ │ ├── Cookie-Monster-19.png │ │ ├── cat3.png │ │ ├── cookie_monster.html │ │ └── stylesheet.css │ ├── index.html │ └── layout.html ├── 02-servi-basics │ ├── hello-servi │ │ └── server.js │ ├── readme.md │ └── servi-file-server │ │ ├── public │ │ └── index.html │ │ └── server.js ├── 03-js │ ├── 0fundamentals │ │ └── object.js │ ├── 1embedded_js │ │ └── simple_javascript1.html │ ├── 2external_js │ │ ├── myscript.js │ │ └── simple_javascript2.html │ ├── 3html_js_css_skeleton │ │ ├── css │ │ │ └── mystyle.css │ │ ├── index.html │ │ └── js │ │ │ └── myscript.js │ ├── 4console │ │ └── console.html │ └── 5dialog-boxes │ │ └── dialog_boxes.html ├── 04-p5js │ ├── empty_example │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js │ └── simple_example │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js ├── 05-dom │ ├── create_dom_dynamic.html │ ├── dom_basics.html │ └── p5_dom │ │ ├── 00_canvas_parent │ │ ├── index.html │ │ └── sketch.js │ │ ├── 01_position_canvas │ │ ├── index.html │ │ └── sketch.js │ │ ├── 03_add_p_element │ │ ├── index.html │ │ └── sketch.js │ │ ├── 04_parent_child │ │ ├── index.html │ │ └── sketch.js │ │ ├── 05_style_functions │ │ ├── index.html │ │ └── sketch.js │ │ ├── 06_style_css │ │ ├── index.html │ │ ├── sketch.js │ │ └── style.css │ │ ├── 07_setting_class │ │ ├── index.html │ │ ├── sketch.js │ │ └── style.css │ │ ├── 08_mousepressed │ │ ├── index.html │ │ └── sketch.js │ │ ├── 09_mouseover_mouseout │ │ ├── index.html │ │ ├── rainbow.png │ │ └── sketch.js │ │ ├── 10_getElement │ │ ├── index.html │ │ └── sketch.js │ │ ├── 11_getElements │ │ ├── index.html │ │ └── sketch.js │ │ ├── 13_animateDOM │ │ ├── index.html │ │ └── sketch.js │ │ ├── 14_button_slider │ │ ├── ball.js │ │ ├── index.html │ │ └── sketch.js │ │ ├── 14a_canvas_p5_dom │ │ ├── index.html │ │ ├── p5.dom.js │ │ ├── p5.js │ │ ├── sketch.js │ │ └── style.css │ │ ├── 15_wordscrambler │ │ ├── index.html │ │ └── sketch.js │ │ └── README.md ├── 06-listeners │ ├── button_listener.html │ ├── keyboard_listener.html │ └── mouse_listener.html ├── 07-json │ ├── animal_tracking.json │ ├── common_names.json │ ├── readme.md │ ├── student_urls.json │ └── weather.json ├── 08-apis │ ├── 00static │ │ ├── index.html │ │ ├── p5.dom.js │ │ ├── p5.js │ │ ├── sketch.js │ │ └── student_urls.json │ ├── 01_weather │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js │ ├── 01_weather_dom │ │ ├── index.html │ │ ├── p5.dom.js │ │ ├── p5.js │ │ └── sketch.js │ ├── 02_capitol_words │ │ ├── index.html │ │ ├── p5.js │ │ ├── sketch.js │ │ └── style.css │ ├── 03_instagram │ │ ├── index.html │ │ └── sketch.js │ └── 04_nytimes │ │ ├── index.html │ │ └── sketch.js ├── 09-jquery │ └── ajax_get │ │ ├── index.html │ │ └── script.js └── 10-server-side │ ├── 00-servi-static-files │ ├── faq.html │ └── server.js │ ├── 01-servi-userprofiles │ └── server.js │ ├── 02-servi-userprofiles-data │ └── server.js │ ├── 03-servi-form-get │ ├── form.html │ └── server.js │ ├── 04-servi-form-post │ ├── form.html │ └── server.js │ ├── 05-servi-template │ ├── server.js │ └── templates │ │ └── page.template.html │ ├── 05a-servi-template-loop │ ├── server.js │ └── templates │ │ └── people_list.html │ ├── 06-servi-db │ ├── people.db │ └── server.js │ ├── 07-servi-db-search │ ├── html │ │ └── searchform.html │ ├── people.db │ └── server.js │ ├── 09-servi-toads │ ├── serve-toad.js │ └── toad_profile.html │ ├── 10-servi-load-json │ ├── server.js │ └── weather.json │ ├── 11-servi-file-uploads │ ├── form.html │ └── upload.js │ ├── 12-servi-blog-templates-db-uploads │ ├── public │ │ └── style.css │ ├── server.js │ └── templates │ │ ├── .tmpscript │ │ ├── blogpost.html │ │ ├── foot.html │ │ ├── form.html │ │ ├── head.html │ │ └── home.html │ └── readme.md ├── docs └── img │ ├── cyberduck_2files.png │ ├── cyberduck_connect.png │ ├── cyberduck_connected.png │ ├── cyberduck_node_modules.png │ ├── cyberduck_open_connection.png │ ├── digital_ocean_create_droplet.png │ ├── servi-browser.png │ ├── servi-exported.png │ ├── servi-file-server.png │ ├── servi-hello.png │ ├── servi-other-page.png │ ├── servi-run.png │ ├── week1 │ └── html_table.png │ ├── week2 │ ├── console_browser_elements.png │ ├── console_detail.png │ ├── console_in_browser.png │ └── openDevTools.png │ └── week4 │ ├── instagramAPI.png │ └── instagramAPI_response.png ├── week1 ├── 01servi │ ├── 00-serve-static-file │ │ ├── home.html │ │ └── server.js │ └── 01-routing │ │ ├── faq.html │ │ └── server.js └── 02javascript │ └── object.js ├── week2 ├── 01-servi │ └── serve-files-from-directory │ │ ├── public │ │ └── index.html │ │ └── server.js └── 02-html-css │ ├── README.md │ ├── basic.html │ ├── css │ └── style.css │ ├── html-css-embedded.html │ ├── img │ └── cat_with_calculator.jpg │ ├── index.html │ └── layout-css-linked.html ├── week3 ├── 01embedded_js │ └── simple_javascript1.html ├── 02external_js │ ├── myscript.js │ └── simple_javascript2.html ├── 03html_js_css_skeleton │ ├── css │ │ └── mystyle.css │ ├── index.html │ └── js │ │ └── myscript.js ├── 04console │ └── console.html ├── 05dom │ ├── 01dom.html │ ├── 02dom_content_loaded.html │ └── create_dom_dynamic.html ├── 06listeners │ ├── button_create_elements.html │ ├── button_listener.html │ ├── keyboard_listener.html │ └── mouse_listener.html └── 07game_example │ ├── css │ └── style.css │ ├── images │ ├── boat.png │ ├── cat.png │ ├── drink.png │ └── shoes.png │ ├── index.html │ └── js │ └── game.js ├── week4 ├── 00-canvas │ ├── README.md │ └── canvas-basic.html ├── 01-p5js │ ├── 01-empty_example │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js │ ├── 02-simple_example │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js │ ├── 03-shapes_array │ │ ├── index.html │ │ └── sketch.js │ ├── 04-images_array │ │ ├── burger.png │ │ ├── chickens.jpg │ │ ├── fish.png │ │ ├── flower.png │ │ ├── index.html │ │ └── sketch.js │ └── 05-objects_array │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js └── 02-p5_dom │ ├── 00_canvas_parent │ ├── index.html │ └── sketch.js │ ├── 01_position_canvas │ ├── index.html │ └── sketch.js │ ├── 03_add_p_element │ ├── index.html │ └── sketch.js │ ├── 04_parent_child │ ├── index.html │ └── sketch.js │ ├── 05_style_functions │ ├── index.html │ └── sketch.js │ ├── 06_style_css │ ├── index.html │ ├── sketch.js │ └── style.css │ ├── 07_setting_class │ ├── index.html │ ├── sketch.js │ └── style.css │ ├── 08_mousepressed │ ├── index.html │ └── sketch.js │ ├── 09_mouseover_mouseout │ ├── index.html │ ├── rainbow.png │ └── sketch.js │ ├── 10_getElement │ ├── index.html │ └── sketch.js │ ├── 11_getElements │ ├── index.html │ └── sketch.js │ ├── 13_animateDOM │ ├── index.html │ └── sketch.js │ ├── 14_button_slider │ ├── ball.js │ ├── index.html │ └── sketch.js │ ├── 14a_canvas_p5_dom │ ├── index.html │ ├── p5.dom.js │ ├── p5.js │ ├── sketch.js │ └── style.css │ ├── 15_wordscrambler │ ├── index.html │ └── sketch.js │ └── README.md ├── week5 ├── 00-json │ ├── 00-javascript-object.js │ ├── animal_tracking.json │ ├── capitol_words.json │ ├── common_names.json │ ├── instagram.json │ ├── movie.json │ ├── readme.md │ ├── student_urls.json │ └── weather.json ├── 01-apis │ ├── 00static │ │ ├── index.html │ │ ├── p5.dom.js │ │ ├── p5.js │ │ ├── sketch.js │ │ └── student_urls.json │ ├── 01_weather │ │ ├── index.html │ │ ├── p5.js │ │ └── sketch.js │ ├── 01_weather_p5_dom │ │ ├── index.html │ │ ├── p5.dom.js │ │ ├── p5.js │ │ └── sketch.js │ ├── 02_capitol_words │ │ ├── index.html │ │ ├── p5.js │ │ ├── sketch.js │ │ └── style.css │ ├── 03_instagram │ │ ├── index.html │ │ └── sketch.js │ └── 04_nytimes │ │ ├── index.html │ │ └── sketch.js └── 02-jquery │ ├── README.md │ └── ajax_get │ ├── index.html │ └── script.js └── week6 ├── 00-servi-static-files ├── faq.html └── server.js ├── 01-servi-userprofiles └── server.js ├── 02-servi-userprofiles-data └── server.js ├── 03-servi-form-get ├── form.html └── server.js ├── 04-servi-form-post ├── form.html └── server.js ├── 05-servi-template ├── server.js └── templates │ └── page.template.html ├── 06-servi-template-loop ├── server.js └── templates │ └── people_list.html ├── 07-servi-template-data ├── serve-toad.js └── toad_profile.html ├── 08-servi-db ├── people.db └── server.js ├── 09-servi-db-search ├── html │ └── searchform.html ├── people.db └── server.js ├── 10-servi-load-json ├── server.js └── weather.json ├── 11-servi-file-uploads ├── form.html └── upload.js ├── 12-servi-blog-templates-db-uploads ├── public │ └── style.css ├── server.js └── templates │ ├── .tmpscript │ ├── blogpost.html │ ├── foot.html │ ├── form.html │ ├── head.html │ └── home.html └── 13-servi_get_api └── servi_http_get.js /.gitignore: -------------------------------------------------------------------------------- 1 | docs/img/week4/instagramAPI.fw.png 2 | 02-servi/_serviScratch/* 3 | 10-server-side/06-servi-db/people.db 4 | sandbox/* 5 | week3/07game_example/images/fw/* 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ITP Comm Lab: Networked Media 2 | ============== 3 | 4 | ###See the [__Wiki__](https://github.com/robynitp/networkedmedia/wiki) for syllabus, assignments, etc. 5 | 6 | * [Syllabus](https://github.com/robynitp/networkedmedia/wiki) 7 | 8 | * [Schedule](https://github.com/robynitp/networkedmedia/wiki#weekly-schedule) 9 | 10 |  11 | 12 | *artwork by Vlad Gerasimov* 13 | -------------------------------------------------------------------------------- /archive/01-html/article.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |The network is one of our most fundamental mediums for interactivity. It makes possible our interaction with machines, data, and, most importantly, other people. Though the base interaction it supports is simple, a client sends a request to a server, which replies; an incredible variety of systems can be and have been built on top of it.
10 | 11 | -------------------------------------------------------------------------------- /archive/01-html/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |I am HTML.
9 | 10 | -------------------------------------------------------------------------------- /archive/01-html/css/style1.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin:0; 3 | background-color: #333; 4 | /*background:url('../img/bg.png') center 0 repeat-y ;*/ 5 | } 6 | #header{ 7 | background: url('../img/logo.png') 0 0 no-repeat; 8 | padding: 0; 9 | margin:0; 10 | border-top: 1px solid #fff; 11 | height: 100px; 12 | } 13 | #header h1{ 14 | text-indent: -9999999px; 15 | } 16 | #outer-container{ 17 | margin: 0 auto; 18 | width:960px; 19 | 20 | } 21 | #container{ 22 | float:left; 23 | width:950px; 24 | background-color: #fff; 25 | } 26 | #nav{ 27 | margin:0; 28 | width:100%; 29 | border-bottom: 1px solid #666; 30 | } 31 | #nav ul{ 32 | margin:0; 33 | height:28px; 34 | } 35 | #nav li{ 36 | display:inline; 37 | border: 1px solid #666; 38 | border-bottom: 0; 39 | padding: 10px 20px; 40 | background-color: #006181; 41 | 42 | } 43 | #nav li a{ 44 | text-decoration: none; 45 | color: #ccc; 46 | } 47 | #nav li:hover{ 48 | background-color:#333; 49 | } 50 | #nav li a:hover{ 51 | color: #ccc; 52 | } 53 | #sidebar { 54 | width:230px; 55 | float:left; 56 | padding: 2em; 57 | } 58 | 59 | #sidebar h3{ 60 | padding-left:20px; 61 | } 62 | #main { 63 | float:left; 64 | width: 610px; 65 | padding: 20px; 66 | border-left: 1px solid #ccc; 67 | 68 | } 69 | h1,h2,h3{ 70 | font-family: Verdana,Arial,Helvetica,sans-serif; 71 | } -------------------------------------------------------------------------------- /archive/01-html/img/cat_with_calculator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robynitp/networkedmedia/3406f7744631d03e2ec72d0553cfe038eac9054e/archive/01-html/img/cat_with_calculator.jpg -------------------------------------------------------------------------------- /archive/01-html/in-class-nov3/Cookie-Monster-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robynitp/networkedmedia/3406f7744631d03e2ec72d0553cfe038eac9054e/archive/01-html/in-class-nov3/Cookie-Monster-19.png -------------------------------------------------------------------------------- /archive/01-html/in-class-nov3/cat3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robynitp/networkedmedia/3406f7744631d03e2ec72d0553cfe038eac9054e/archive/01-html/in-class-nov3/cat3.png -------------------------------------------------------------------------------- /archive/01-html/in-class-nov3/cookie_monster.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Stop floating now!
26 |I am HTML.
10 |Here is an article: 14 Things That Are Meaningless
11 |I wrote this article: 10 things about the web
12 | 13 | -------------------------------------------------------------------------------- /archive/01-html/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |But, soft! What light through yonder window breaks? 33 | It is the east, and Juliet is the sun! 34 | Arise fair sun and kill the envious moon, 35 | Who is already sick and pale with grief 36 | That thou her maid are more fair than she.
37 | 38 |Hello, world. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis cursus bibendum varius. Donec eleifend mattis magna. Mauris arcu velit, viverra in molestie non, fringilla sed tellus. Proin eget nibh sed velit ultricies tincidunt. Quisque lorem tortor, tincidunt et suscipit at, rhoncus non ligula. Praesent eget odio vitae ipsum ornare malesuada suscipit eu augue. Maecenas dapibus suscipit quam ac porta. Nulla feugiat fringilla dolor, a mattis dolor posuere et. Fusce vel pharetra quam. Duis blandit, nisl dapibus lobortis egestas, tortor arcu convallis sem, sed euismod lacus nunc ac urna. Pellentesque mauris lacus, molestie sed semper ac, ornare vitae eros. Ut sed mi justo, vitae cursus odio. Aenean adipiscing, quam eu dictum vehicula, tellus ipsum iaculis mi, id porta leo lectus vehicula eros. Vestibulum aliquam augue eget nisl congue ac ullamcorper sem mollis.
39 | 40 |I am HTML.
9 | 10 | -------------------------------------------------------------------------------- /archive/02-servi-basics/servi-file-server/server.js: -------------------------------------------------------------------------------- 1 | // serve files from a directory named "public" 2 | serveFiles("public"); 3 | 4 | /* 5 | 6 | NOTE: Make sure to create a directory in your Servi project called "public" 7 | and put at least one HTML file in it. 8 | 9 | If you include a file called "index.html", it will show up automatically as your home page. 10 | 11 | */ -------------------------------------------------------------------------------- /archive/03-js/0fundamentals/object.js: -------------------------------------------------------------------------------- 1 | var allColors = { 2 | red: { 3 | title: "Red as in Crimson", 4 | hexcode: "#ff0000" 5 | }, 6 | green: { 7 | title: "Green as in Kale", 8 | hexcode: "#00ff00" 9 | }, 10 | blue: { 11 | title: "Blue as in Sky", 12 | hexcode: "#0000ff" 13 | }, 14 | }; 15 | 16 | console.log("The object containing all the color objects:"); 17 | console.log(allColors); 18 | 19 | var color = "red"; 20 | 21 | var chosenColorObject = allColors[color]; 22 | 23 | console.log("The object with the property name, " + color + ":"); 24 | console.log(chosenColorObject); -------------------------------------------------------------------------------- /archive/03-js/1embedded_js/simple_javascript1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Javascript is embedded in a script tag inside the head tag. 12 | For Javascript longer than a few lines, it's a good practice to put Javascript in a separate file and link to it in the HTML. 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /archive/03-js/2external_js/myscript.js: -------------------------------------------------------------------------------- 1 | console.log("Hello World from an external file"); -------------------------------------------------------------------------------- /archive/03-js/2external_js/simple_javascript2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |The Javascript that this file uses is contained in an external file called "myscript.js"
10 | 11 | 12 | -------------------------------------------------------------------------------- /archive/03-js/3html_js_css_skeleton/css/mystyle.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #0762D9; 3 | } -------------------------------------------------------------------------------- /archive/03-js/3html_js_css_skeleton/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |This file has external CSS and Javascript
11 | 12 | -------------------------------------------------------------------------------- /archive/03-js/3html_js_css_skeleton/js/myscript.js: -------------------------------------------------------------------------------- 1 | console.log("Hello World from an external file"); -------------------------------------------------------------------------------- /archive/03-js/5dialog-boxes/dialog_boxes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Pop-ups ahoy! Some quick and dirty ways to get input from the user. See this tutorial on dialog boxes for more info.
16 | 17 | 18 |This is Ground Control 54 | to Major Tom 55 | You've really made the grade 56 | And the papers want to know whose shirts you wear 57 | Now it's time to leave the capsule 58 | if you dare
59 |This is Major Tom to Ground Control 60 | I'm stepping through the door 61 | And I'm floating 62 | in a most peculiar way 63 | And the stars look very different today
64 |David Bowie
65 |This is a paragraph element.
12 | // By default these elements are appended to the 13 | // Try reversing these two lines of code and see the difference 14 | var text = createP("This is a paragraph element."); 15 | var canvas = createCanvas(300, 200); 16 | 17 | // Here we call methods of each element to set the position and id, try changing these values. 18 | // Use the inspector to look at the HTML generated from this code when you load the sketch in your browser. 19 | text.id("apple"); 20 | // If we wanted absolute positioning, if not the elements just "float" in the order they are created 21 | // canvas.position(300, 50); 22 | canvas.id("pear"); 23 | } 24 | 25 | // A simple animation 26 | function draw() { 27 | background(51); 28 | stroke(255); 29 | line(frameCount % width, 0, frameCount % width, height); 30 | } 31 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/04_parent_child/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/04_parent_child/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | function setup() { 9 | 10 | // We can put other HTML stuff inside our DOM elements 11 | var text = createP("Here is some text and this is an HTML link! "); 12 | 13 | // But p5 also has some functions to create specific elements like a link 14 | var link = createA("http://i.imgur.com/WXaUlrK.gif","We can also create a link this way.") 15 | 16 | var canvas = createCanvas(300, 200); 17 | 18 | // We can put the link element inside the paragraph one with child() 19 | text.child(link); 20 | // link.parent(child); // this is the equivalent 21 | } 22 | 23 | 24 | 25 | // A simple animation 26 | function draw() { 27 | background(51); 28 | stroke(255); 29 | line(frameCount % width, 0, frameCount % width, height); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/05_style_functions/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/05_style_functions/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | function setup() { 9 | 10 | // If we don't want a canvas (p5 creates one by default even if you don't ask) 11 | noCanvas(); 12 | 13 | // Make a paragraph element 14 | var text = createP("This is some stuff in a paragraph that is dynamically styled with style()"); 15 | 16 | // With the style method we can pass in CSS directly in our code 17 | text.style("font-family", "monospace"); 18 | text.style("background-color", "#FF69B4"); 19 | text.style("color", "#FFFFFF"); 20 | text.style("font-size", "18pt"); 21 | text.style("padding", "10px"); 22 | } 23 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/06_style_css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/06_style_css/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | function setup() { 9 | noCanvas(); 10 | 11 | // Make a paragraph element 12 | var text = createP("This is some stuff in a paragraph that pulls its style from CSS via an id set by p5."); 13 | 14 | // Set its id (for which the styles are specified in style.css) 15 | text.id("apple"); 16 | } 17 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/06_style_css/style.css: -------------------------------------------------------------------------------- 1 | #apple { 2 | font-family: monospace; 3 | background-color: #FF69B4; 4 | color: #FFFFFF; 5 | font-size: 18pt; 6 | padding: 10px; 7 | } -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/07_setting_class/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/07_setting_class/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | // Three elements 9 | var elt0; 10 | var elt1; 11 | var elt2; 12 | 13 | function setup() { 14 | 15 | noCanvas(); 16 | 17 | // Three floating elements 18 | elt0 = createDiv("Here's a div."); 19 | elt1 = createDiv("Here's another div."); 20 | elt2 = createDiv("Oh and even another one!"); 21 | 22 | // Let's give the first two elements class donkey, and the third class yogurt. 23 | elt0.class('donkey'); 24 | elt1.class('donkey'); 25 | elt2.class('yogurt'); 26 | }; 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/07_setting_class/style.css: -------------------------------------------------------------------------------- 1 | .donkey { 2 | font-family: monospace; 3 | background-color: #FF69B4; 4 | color: #FFFFFF; 5 | font-size: 18pt; 6 | padding: 10px; 7 | margin: 20px; 8 | } 9 | 10 | .yogurt { 11 | font-family: monospace; 12 | font-size: 18pt; 13 | } 14 | 15 | /* We're about to deal with events, but here's a quick way to get a mouse rollover with CSS */ 16 | /* this is mostly used with a href */ 17 | .yogurt:hover { 18 | margin: 20px; 19 | background-color: #FF69B4; 20 | } -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/08_mousepressed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/08_mousepressed/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | // Using p5 DOM element mouse listeners, mousePressed. 9 | 10 | // Global variable for background color 11 | var bg; 12 | 13 | function setup() { 14 | createCanvas(400, 400); 15 | bg = color(51); 16 | 17 | var link = createA("#","Click me"); 18 | // The function changeBG becomes a callback for when the mouse is pressed 19 | // On this DOM element (different than mousePressed() anywhere on page) 20 | link.mousePressed(changeBG); 21 | 22 | } 23 | 24 | function draw() { 25 | background(bg); 26 | } 27 | 28 | // This function is triggered when the mouse is pressed on the link 29 | function changeBG() { 30 | bg = color(random(255)); 31 | } 32 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/09_mouseover_mouseout/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/09_mouseover_mouseout/rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robynitp/networkedmedia/3406f7744631d03e2ec72d0553cfe038eac9054e/archive/05-dom/p5_dom/09_mouseover_mouseout/rainbow.png -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/09_mouseover_mouseout/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | // Using p5 DOM element mouse listeners, mouseOver and mouseOut. 9 | 10 | // We define the variables outside of setup so we can access them from anywhere in the sketch. 11 | var img; 12 | var canvas; 13 | 14 | 15 | function setup() { 16 | 17 | createP("The image appears only when the mouse is over the canvas element.") 18 | 19 | // Make the canvas 20 | canvas = createCanvas(320, 240); 21 | // Make an HTML image element (different from loadImage()!) 22 | img = createImg("rainbow.png"); 23 | 24 | // Here we call methods of DOM Image element to set the size and style. 25 | // Note the use of "AUTO" to keep the aspect ration 26 | img.size(200, AUTO); 27 | img.style("padding","10px"); 28 | 29 | // Attach listeners for mouse events related to canvas 30 | canvas.mouseOver(uniShow); 31 | canvas.mouseOut(uniHide); 32 | }; 33 | 34 | 35 | // A simple animation 36 | function draw() { 37 | background(51); 38 | stroke(255); 39 | line(frameCount % width, 0, frameCount % width, height); 40 | } 41 | 42 | // Create functions for hiding and showing uni image. 43 | // These will be hooked into mouse events related to canvas above. 44 | function uniHide() { 45 | img.hide(); 46 | } 47 | 48 | function uniShow() { 49 | img.show(); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/10_getElement/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | 28 | 29 | 30 |Press 'a', 'b', or 'p' to hide an element.
Press space to show all elements.
apple
32 |banana
33 |pear
34 | 35 | 36 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/10_getElement/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | 8 | // Three variables to hold our DOM elements 9 | var apple; 10 | var banana; 11 | var pear; 12 | 13 | function setup() { 14 | noCanvas(); 15 | // Instead of making the elements here we can just grab them 16 | // via their id (see index.html) 17 | apple = getElement('apple'); 18 | banana = getElement('banana'); 19 | pear = getElement('pear'); 20 | } 21 | 22 | // Hide and show them depending on what key was pressed 23 | function keyPressed() { 24 | if (key == 'A') { 25 | apple.hide(); 26 | } else if (key == 'B') { 27 | banana.hide(); 28 | } else if (key == 'P') { 29 | pear.hide(); 30 | } else if (key == ' ') { 31 | apple.show(); 32 | banana.show(); 33 | pear.show(); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/11_getElements/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 20 | 21 | 22 | 23 |1 apple
24 |2 apples
25 |3 apples
26 | 27 | 28 | -------------------------------------------------------------------------------- /archive/05-dom/p5_dom/11_getElements/sketch.js: -------------------------------------------------------------------------------- 1 | // ITP Networked Media, Fall 2014 2 | // DOM Manipulation 3 | // https://github.com/shiffman/itp-networked-media 4 | // Daniel Shiffman 5 | 6 | // These are adapted from https://github.com/lmccart/itp-creative-js 7 | // Creating other HTML elements, adding style. 8 | 9 | function setup() { 10 | noCanvas(); 11 | 12 | var link = getElement("clicky"); 13 | link.mousePressed(shuffle); 14 | } 15 | 16 | 17 | function shuffle() { 18 | // Get an array of elements of the same class 19 | var apples = getElements("apple"); 20 | // Do something to all of them 21 | for (var i=0; iPlease enter some text:
10 | 11 | 12 |use the keyboard arrows to move me
75 |Click the mouse to re-position the box
42 |with the person's name 26 | createP(personObject.name); 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /archive/08-apis/00static/student_urls.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Brett Stiller", 4 | "url": "http://brettstiller.xyz/?cat=6" 5 | }, 6 | { 7 | "name": "Catherine Rehwinkel", 8 | "url": "http://www.catherinerehwinkel.com/itp-nyu/" 9 | }, 10 | { 11 | "name": "Craig Pickard", 12 | "url": "http://www.craigwentdigital.com/category/networked-media/" 13 | }, 14 | { 15 | "name": "Lisa In Young Song", 16 | "url": "http://lisaisong.com/networked-media" 17 | }, 18 | { 19 | "name": "Julia Irwin", 20 | "url": "http://www.juliasbetablog.com/category/networked-media/" 21 | }, 22 | { 23 | "name": "Louis Minsky", 24 | "url": "http://www.louisminsky.com/?q=blog/networked-media/" 25 | }, 26 | { 27 | "name": "Maria Fang", 28 | "url": "http://www.mariafangitp.com/category/networked-media/" 29 | }, 30 | { 31 | "name": "Matt Romein", 32 | "url": "http://www.itp-mromein.com/" 33 | }, 34 | { 35 | "name": "Melissa Felderman", 36 | "url": "http://www.feldiblog.com/?cat=9" 37 | }, 38 | { 39 | "name": "Sergio Mora", 40 | "url": "http://itp.smorad.com/category/commlab-network/" 41 | }, 42 | { 43 | "name": "Will Field", 44 | "url": "http://www.willjfield.com/?cat=5" 45 | } 46 | ] -------------------------------------------------------------------------------- /archive/08-apis/01_weather/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /archive/08-apis/01_weather/sketch.js: -------------------------------------------------------------------------------- 1 | /* 2 | from: 3 | Lauren McCarthy 4 | https://github.com/lmccart/p5.js/wiki/Loading-external-files:-AJAX,-XML,-JSON 5 | 6 | */ 7 | 8 | function setup() { 9 | createCanvas(600, 400); 10 | noStroke(); 11 | loadJSON('http://api.openweathermap.org/data/2.5/weather?q=NewYork,USA', drawWeather); 12 | } 13 | 14 | function drawWeather(weather) { 15 | 16 | // Get the loaded JSON data 17 | console.log(weather); // inspect the weather JSON 18 | var humidity = weather.main.humidity; // get the main.humidity out of the loaded JSON 19 | console.log(humidity); // inspect the humidity in the console 20 | 21 | background(40, 90, 200); 22 | fill(0, 255, 255, humidity); // use the humidity value to set the alpha 23 | for (var i = 0; i < 50; i++) { 24 | ellipse(random(width), random(height), 30, 30); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /archive/08-apis/01_weather_dom/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |Q: What is Servi?
10 |A: servi.js is a JavaScript node.js microframework for creating web servers. It is inspired by Processing and p5.js.
11 |Q: Where do I find documentation?
13 |A: For some Servi basics, see the servi.js github wiki
14 |Q: How do I do this in Servi?
16 |A: For more info on how to do this assingment, see Using Servi in the Networked Media class wiki
17 | 18 | -------------------------------------------------------------------------------- /archive/10-server-side/00-servi-static-files/server.js: -------------------------------------------------------------------------------- 1 | // every servi application must have these 2 lines 2 | var servi = require('servi'); 3 | var app = new servi(true); 4 | 5 | // set the port (defaults to 3000 if you leave out this line) 6 | port(3001); // make sure "port()" line comes before "start()" 7 | start(); 8 | // set up the routes 9 | route('/',showHome); 10 | route('/about',myAboutPage); 11 | route('/faq',viewFaq); 12 | 13 | function showHome(request){ 14 | // serve a simple string 15 | request.respond("This is the home page."); 16 | } 17 | 18 | function myAboutPage(request){ 19 | // build a string with some HTML in it 20 | var myHtml = "I am a person from earth.
"; 22 | // serve the HTML string 23 | request.respond(myHtml); 24 | } 25 | 26 | function viewFaq(request){ 27 | // serve a static HTML file 28 | request.serveFile('faq.html'); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /archive/10-server-side/01-servi-userprofiles/server.js: -------------------------------------------------------------------------------- 1 | // every servi application must have these 2 lines 2 | var servi = require('servi'); 3 | var app = new servi(true); 4 | 5 | // set the port (defaults to 3000 if you leave out this line) 6 | port(3111); // make sure "port()" line comes before "start()" 7 | start(); 8 | // set up the routes 9 | route('/',showHome); 10 | route('/about',myAboutPage); 11 | 12 | function showHome(request){ 13 | request.respond("This is the home page."); 14 | } 15 | 16 | function myAboutPage(request){ 17 | request.respond("All the user's info here
"; 25 | request.respond(content); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /archive/10-server-side/02-servi-userprofiles-data/server.js: -------------------------------------------------------------------------------- 1 | // every servi application must have these 2 lines 2 | var servi = require('servi'); 3 | var app = new servi(true); 4 | 5 | // set the port (defaults to 3000 if you leave out this line) 6 | port(7777); //make sure this comes before "start()" 7 | start(); 8 | // set up the routes 9 | route('/',showHome); 10 | route('/profile/:userid',showProfile); 11 | 12 | var users = [ 13 | { 14 | "name": "Joe", 15 | "about": "I like cats and kittens." 16 | }, 17 | { 18 | "name": "Jane", 19 | "about": "I live in Alberta and like to code." 20 | }, 21 | { 22 | "name": "Morgan", 23 | "about": "Craft beer and pickles and kale!" 24 | } 25 | ]; 26 | 27 | function showHome(request){ 28 | request.respond("This is the home page."); 29 | } 30 | 31 | function showProfile(request){ 32 | var id = request.params.userid; 33 | if (id in users){ 34 | var name = users[id].name; 35 | var about = users[id].about; 36 | var content = "" + about + "
"; 38 | request.respond(content); 39 | } else { 40 | request.respond("Could not find that user id
"); 41 | } 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /archive/10-server-side/03-servi-form-get/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Return home
13 | 14 | -------------------------------------------------------------------------------- /archive/10-server-side/07-servi-db-search/people.db: -------------------------------------------------------------------------------- 1 | {"name":"Dan","date_added":"Sun Nov 30 2014 22:00:04 GMT-0500 (EST)","_id":"DGW46VG8N1kCsOXH"} 2 | {"name":"Annabelle","date_added":"Sun Nov 30 2014 21:59:26 GMT-0500 (EST)","_id":"S0hQsabVo80Rw7Ln"} 3 | {"name":"Julia","date_added":"Sun Nov 30 2014 21:59:07 GMT-0500 (EST)","_id":"jG2eAyNxMUrCbzqp"} 4 | {"name":"Diego","date_added":"Sun Nov 30 2014 21:56:30 GMT-0500 (EST)","_id":"t5GLbvx9qyRiJHW7"} 5 | {"name":"Janet","date_added":"Sun Nov 30 2014 21:56:15 GMT-0500 (EST)","_id":"yaZf0BFknoNXYcVA"} 6 | {"name":"Ziggy","date_added":"Sun Nov 30 2014 22:01:33 GMT-0500 (EST)","_id":"t32vvLCPk8xYXTwD"} 7 | {"name":"Dan","date_added":"Sun Nov 30 2014 22:01:51 GMT-0500 (EST)","_id":"WR9a7FDWcEapmXB3"} 8 | -------------------------------------------------------------------------------- /archive/10-server-side/09-servi-toads/serve-toad.js: -------------------------------------------------------------------------------- 1 | var servi = require('servi'); 2 | var app = new servi(true); 3 | port(3002); 4 | start(); 5 | route('/',showHome); 6 | route('/toads/:toadName',getToad); 7 | 8 | myToadCollection = { 9 | yosemite: { 10 | common_name: 'Yosemite Toad', 11 | scientific_name: 'Anaxyrus canorus', 12 | description: 'A robust and stocky toad with dry, uniformly warty skin.', 13 | photo: 'http://www.californiaherps.com/frogs/images/acanorusac7116.jpg', 14 | sounds: 'http://www.californiaherps.com/sounds/bcanorus7.mp3' 15 | }, 16 | boreal: { 17 | common_name: 'Boreal Toad', 18 | scientific_name: 'Anaxyrus boreas boreas', 19 | description: 'A large and robust toad with dry, warty skin.', 20 | photo: 'http://www.californiaherps.com/frogs/images/bbboreasrnphumboldt.jpg', 21 | sounds: 'http://www.californiaherps.com/sounds/bbboreasfl406solo.mp3' 22 | } 23 | }; 24 | 25 | function showHome(request){ 26 | var toadListText = ''; 27 | for (shortname in myToadCollection){ 28 | //console.log(i); 29 | var toad = myToadCollection[shortname]; 30 | //Common Name: <%= common_name %>
12 |Scientific Name: <%= scientific_name %>
13 |Description: <%= description %>
14 | 15 |The temperature in " + city + " was once " + temp + "F
"; 27 | content += ''; 28 | request.respond(content); 29 | }); 30 | 31 | /* === Note: === 32 | These examples use an anonymous function as the 2nd parameter in loadJSON(). 33 | If you prefer, you could instead use a named function, like this: 34 | 35 | loadJSON('weather.json',gotWeather); 36 | function gotWeather(dataObj){ 37 | // do stuff 38 | } 39 | 40 | */ 41 | } 42 | 43 | function fromUrlDemo(request){ 44 | var content = ''; 45 | 46 | // OPTION 2. Load JSON from a URL 47 | var myUrl = "http://api.openweathermap.org/data/2.5/weather?q=London,uk"; 48 | loadJSON(myUrl,function(dataObj){ 49 | // get data points from the object 50 | var temp = dataObj.main.temp; 51 | var city = dataObj.name; 52 | 53 | console.log("loaded from URL"); 54 | content += "The temperature in " + city + " right now is " + temp + "K
"; 55 | content += ''; 56 | request.respond(content); 57 | }); 58 | } 59 | 60 | /* 61 | === 62 | === To work with JSON, add these 2 utility functions in your script === 63 | === Then call loadJSON() as in the demos above. 64 | === 65 | */ 66 | 67 | // load text from a url 68 | function loadURL(url,onSuccess){ 69 | var str = ''; 70 | http.get(url, function(res) { 71 | res.on("data", function(chunk) { 72 | str += chunk.toString(); 73 | }); 74 | res.on("end",function(){ 75 | onSuccess(str); 76 | }); 77 | }).on('error', function(e) { 78 | console.log("Got error: " + e.message); 79 | // use an onError() callback here? 80 | }); 81 | } 82 | 83 | // load JSON from a local file or a URL 84 | function loadJSON(path,callback){ 85 | // is it a URL ? 86 | if (path.indexOf('http') === 0){ 87 | loadURL(path, function(res){ 88 | callback(JSON.parse(res)); 89 | }); 90 | } else { // assume it's a file 91 | callback(JSON.parse(loadFile(path))); 92 | } 93 | } -------------------------------------------------------------------------------- /archive/10-server-side/10-servi-load-json/weather.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "coord": { 4 | "lon": -74.01, 5 | "lat": 40.71 6 | }, 7 | "sys": { 8 | "type": 1, 9 | "id": 1980, 10 | "message": 0.115, 11 | "country": "US", 12 | "sunrise": 1416311222, 13 | "sunset": 1416346537 14 | }, 15 | "weather": [ 16 | { 17 | "id": 500, 18 | "main": "Rain", 19 | "description": "light rain", 20 | "icon": "10n" 21 | }, 22 | { 23 | "id": 701, 24 | "main": "Mist", 25 | "description": "mist", 26 | "icon": "50n" 27 | }, 28 | { 29 | "id": 300, 30 | "main": "Drizzle", 31 | "description": "light intensity drizzle", 32 | "icon": "09n" 33 | } 34 | ], 35 | "base": "cmc stations", 36 | "main": { 37 | "temp": 47.84, 38 | "pressure": 1000, 39 | "humidity": 93, 40 | "temp_min": 42.8, 41 | "temp_max": 57.2 42 | }, 43 | "wind": { 44 | "speed": 3.24, 45 | "deg": 270 46 | }, 47 | "clouds": { 48 | "all": 90 49 | }, 50 | "dt": 1416267540, 51 | "id": 5128581, 52 | "name": "New York", 53 | "cod": 200 54 | } -------------------------------------------------------------------------------- /archive/10-server-side/11-servi-file-uploads/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |