1 / 37

Code Your Constellations!

Code Your Constellations!. #IBMSTEM4Girls. Welcome!. Your star-guides : Felise Chrissie Arlene Rae Andrea. Activity outline. You will each be given a constellation to document. You will need to: Determine the coordinates for each star in the constellation

albert
Download Presentation

Code Your Constellations!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Code Your Constellations! #IBMSTEM4Girls

  2. Welcome! #IBMSTEM4Girls Your star-guides: Felise Chrissie Arlene Rae Andrea

  3. Activity outline #IBMSTEM4Girls • Youwill each be given a constellation to document. You willneed to: • Determine the coordinates for each star in the constellation • Get the computer to draw them in the correct position • Add some additional information about the stars or the constellation • Add some information about you, the author • Make your web page look super awesome!

  4. Let’s find out the coordinatesof the stars in your constellation(we will use this to plot the constellations on the webpage) #IBMSTEM4Girls

  5. Let’s find out the coordinates of the stars in your constellation Imagine the sky as an x-y coordinate plane, with the origin (0,0) positioned at the bottom left corner. #IBMSTEM4Girls

  6. Let’s find out the coordinates of the stars in your constellation • y-axis x-axis #IBMSTEM4Girls

  7. Let’s find out the coordinates of the stars in your constellation 1 Unit coordinate plane #IBMSTEM4Girls

  8. Let’s find out the coordinates of the stars in your constellation (x, y) (x, y) (x, y) coordinate plane #IBMSTEM4Girls

  9. #IBMSTEM4Girls Let’s plot our constellations!

  10. Three Elements of a Web Page 2. JavaScript “The moving parts” Interactivity and Functionality We’ll be adding your coordinates here! A web page is like a house 1. HTML “The house frame” Web page structure 3. CSS “The look” Look and feel A web page!

  11. “The house frame” What is HTML? HyperTextMarkup Language This language is based on English keywords called tagsthat tell a web browser how to display content on a web page.

  12. Examples of HTML tags <p> <br> <div> <h1> <footer> <canvas>

  13. HTML tags • Tags always have angle brackets < >on both ends, with a keyword in the middle: <p> <h1> • Tags typically come in pairs -- an opening tag and a closing tag with a forward slash: <p> </p> <h1> </h1> • Tags can also be nested inside of another pair of tags, like this: <div><p></p></div> “p” stands for paragraph

  14. HTML tags How do they work? Like a juicy hamburger, HTML needs and opening and closing tag to hold it together <p> Juicy content in between </p>

  15. HTML tags End tag #1 Start tag #1 • <p>What geometric shape is your constellation?</p> • <p>Tell us something interesting about your constellation</p> Start tag #2 End tag #2

  16. Some useful HTML tags <h1> … <h6>: Creates headings in the web page, with heading 1 appearing larger than heading 2, which is larger than heading 3. <p>: Paragraph tag, creates a paragraph for text • <div>: Div tag, creates a section for text or picture content • <canvas>: Canvas tag, used to draw graphics on a web page  <a href=”www.example.com”>An awesome link</a>: Anchor tag, creates a link to another web page. <imgsrc=”http://placekitten.com/g/200/200”>: Displays a picture in the web page

  17. Codepen Online HTML/CSS/JS playground that lets you see results immediately A “pen” is a chunk of code that can render a webpage and can be shared with other users. Demo

  18. Let’s practice! USE THE HTML EDITOR • Open the Simple Constellation pen: https://codepen.io/ibmstem4girlsgta/pen/ZjvVRG • Find the paragraph tag called “myParagraph” and update the text. • Add your name, grade, and school in the footer tag.

  19. What is CSS? “The look” Cascading Style Sheets • Lets you control the colours and layout of a webpageusing specific properties

  20. Examples of CSS properties color background-color font-size font-weight text-align border padding margin

  21. What CSS looks like In the CSS: • h1 { • background-color: midnightblue; • color:white; • font-weight: bold; • } • In the HTML:<h1>Your constellation name goes here!</h1>

  22. Some Sample CSS Properties In the CSS: • h1 { • background-color: green; • color:white; • font-weight: bold; • }

  23. Some Sample CSS Properties In the CSS: • h1 { • background-color: green; • color:yellow; • font-weight: bold; • }

  24. Some Sample CSS Properties In the CSS: • h1 { • background-color: green; • color:yellow; • font-weight: bold; • border: solid; • }

  25. Some Sample CSS Properties In the CSS: • h1 { • background-color: green; • color:yellow; • font-weight: bold; • font-size: 4em; • }

  26. Let’s practice! USE THE CSS EDITOR • Try changing the background-color and color of the body element. • Change the font-size of the h1 element. • Change the color of the myParagraph element. • Change the color of the footer element.

  27. JavaScript - the “moving parts” • The most widely used programming language • A way to add programs to web pages • Adds functionality and interaction to web pages • Any web page you see today is most likely using JavaScript JavaScript will be used to add your stars to the webpage!

  28. How do you store information about a star? • Saved in key/value pairs in the JavaScript • "x_coordinate" : 2 Key Value

  29. How do you store information about a star? • Use commasto separate different pairs of data • "x_coordinate" : 2, • "y_coordinate" : 4,"color":"yellow", • "number_of_spikes":5

  30. How do you store information about a star? • Use curly brackets { } to hold information for one star • {"x_coordinate" : 2, • "y_coordinate" : 4, • "color":"yellow", • "number_of_spikes":5}

  31. How do you store information about allstars? • Use square brackets [ ]to hold information for all of the stars in the constellation • [{"x_coordinate" : 2, • "y_coordinate" : 4, • "color":"yellow", • "number_of_spikes":5}, • {"x_coordinate" : 6, • "y_coordinate" : 10, • "color":"yellow", • "number_of_spikes":6}]

  32. How do you store information about allstars? • As a JSON object in the JavaScript • (JavaScript Object Notation) • [{"x_coordinate" : 2, • "y_coordinate" : 4, • "color":"yellow", • "number_of_spikes":5}, • {"x_coordinate" : 6, • "y_coordinate" : 10, • "color":"yellow", • "number_of_spikes":6}] Stars: Key Value

  33. Let’s add the stars! FOLLOW ALONG CAREFULLY • Open the Constellations JSON generator pen in a new tab: https://codepen.io/ibmstem4girlsgta/full/vapvad/ • Choose the constellation Name and enter the (x,y) coordinates for your first star, the colour, and the number of spikes. • Click on “Add Star”. • Repeat steps 3 and 4 until all stars are added. 

  34. Let’s add the stars! FOLLOW ALONG CAREFULLY You should see something like this below:

  35. Oops! I made a mistake FOLLOW ALONG CAREFULLY • If you make a mistake, you can delete the star. • Find the Star ID. • Copy the ID name into top right • box and press “Delete Star.”

  36. Let’s add the coordinates! FOLLOW ALONG CAREFULLY Copy the constellations JSON from the box. Paste the JSON in the Javascript editor of the Simple Constellation pen, after the comment line that says // COPY AND PASTE YOUR JSON HERE.

  37. More practice! • Add text describing your constellation to the paragraph tags with ids “my-description-1” and “my-description-2”. • Change the font-size of the “.myParagraph” element in the CSS. • Add a background-color to the footerin the CSS. • Add a coloured border to thefooter. Hint: Use the border-color and border properties • Change the color and the number of spikes on some of the stars in your constellation. • Add a coloured border to the canvas element. Hint: Use the border-color and border properties. • Create your own constellation. Ask the instructors for a piece of grid paper. • Add an image to your webpage.

More Related