cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <canvas id="myCanvas"> </canvas>
<base target="_blank">
<!-- makes all links open in new tab -->
<a name='top'></a>
<header>
  <ul class="navigation" role="navigation">
    <li><a href="#HTML" class="border" target="_self">HTML</a></li>
    <li><a href="#CSS" class="border" target="_self">CSS</a></li>
    <li><a href="#hosting" class="border" target="_self">Hosting</a></li>
    <li><a href="#js" class="border" target="_self">JavaScript</a></li>
    <li><a href="#js canvas" class="border" target="_self">Canvas</a></li>
    <li><a href="#mobile" class="border" target="_self">Mobile</a></li>
    <li><a href="#lib" class="border" target="_self">Libraries</a></li>
    <li><a href="#arduino" class="border" target="_self">Arduino</a></li>
  </ul>
</header>
<div class='bmo'>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/464612/Bmo.png" align="middle" width="180" height="159">
</div>
<article>
  
  <h1 id="titlemain">Computer Science - Fall 2016</h1>
  <center><p>Back to <a href='http://landgreen.github.io/'>Mr. Landgreen's</a> home page</p>
<!--     <p> <a href = "https://docs.google.com/forms/d/e/1FAIpQLSc-FDoaI6ww9COXCVgdSstkyQODnuALx6PpVVi53hi_SF6p8A/viewform">mid year survey</a></p> -->
  
  </center>

  <!--   ******************************* -->
  <br>
  <a name='HTML'></a>
  <h1 class="underlined">HTML</h1>

  <div class='task'>
    <h2>task - learn HTML syntax</h2>
    <p> Make an account on <a href='https://www.codecademy.com/'>codecademy</a>.
      <br>
      <br>Under the unit on language skills
      <br>Select <a href='https://www.codecademy.com/learn/web'>HTML & CSS</a>.
      <br>Complete unit 1: INTRODUCTION TO HTML
      <br>Complete unit 2: HTML STRUCTURE: USING LISTS
      <br>Complete unit 3: HTML STRUCTURE: TABLES, DIVS, AND SPANS
    </p>
  </div>

  <div class='project'>
    <h2>project - make a web site</h2>
    <p><b>choose a topic:</b> music, TV show, project for another class, game, a guide to ____, cooking, sports teams, your bio, an art gallery, ...
    </p>
    <p>Make an account on <a href='http://codepen.io/'>codepen</a>.
      <br>Make a <b>+ New Pen</b>
      <br>In the HTML section start writing a website:
      <br>There must be: headings, p, div, br, <a href="http://codepen.io/" target="_blank">links</a>, <b>bold</b>, <i>italics</i>, hidden, ...

      <p>Codepen automatically adds html and body elements as hidden and it links your JavaScript, and css pages to the index.html.</p>
      <p><a href='http://www.w3schools.com/html/'>W3 Schools</a> is a good reference for syntax.
        <p>
        </p>
  </div>

  <div class='info'>
    <h2>Resources</h2>
    <p> <a href='https://internetingishard.com/html-and-css/'> HTML and CCS guide</a>
      <br><a href='http://htmlreference.io/'> HTML Elements Reference</a>
    </p>
  </div>
  
  
  

  <!--   ****************************************** -->
  <br>
  <a name='CSS'></a>
  <h1 class="underlined">CSS</h1>

  <div class='task'>
    <h2>task - learn CSS syntax</h2>
    <p> Back to <a href='https://www.codecademy.com/' target="_blank">codecademy</a> select <a href='https://www.codecademy.com/learn/web'>HTML & CSS</a>.
      <br>Complete UNIT 4: INTRODUCTION TO CSS
      <br>Complete UNIT 5: CSS CLASSES AND IDS
      <br>Complete UNIT 6: CSS ELEMENT POSITIONING
      <p>Read some web developers <a href='https://css-tricks.com/moment-css-started-making-sense/'>writing</a> about learning CSS.
      </p>
  </div>

  <div class='quiz'>
    <h2><a href= "https://docs.google.com/a/newwestcharter.org/forms/d/e/1FAIpQLSeNhnaQNoybCo0PgD-jDBsgH7c_O0e6uJMVpM_7UX2L4PC0BA/viewform" target="_blank">quiz</a> - colors!</h2>
    <p>Learn <span style='color: green'>c</span><span style='color: red'>o</span><span style='color: #888'>l</span><span style='color: #991'>o</span><span style='color: pink'>r</span><span style='color: RGB(255,0,255)'>s</span>: <a href='http://htmlcolorcodes.com/'>HTML Color Codes</a>
      <br>Learn advanced methods: <a href='https://css-tricks.com/nerds-guide-color-web/' target="_blank">CSS-Tricks</a>.
      <br>Be able to tell roughly what color comes from RGB, and HEX codes.
      <br>Be able to write the RGB and HEX codes for different colors.
    </p>
  </div>

  <div class='project'>
    <h2>project - make your web site pretty</h2>
    <p>Return to your web site project on <a href='http://codepen.io/'>codepen</a>.
      <br>In the CSS section add in some style
      <br>Use: <span style='color: #f0f'>color</span>, <span style='background-color: #cdc'>background-color</span>, <span style='font-family: "Times New Roman", Times, serif;'>font</span>, <span style='padding: 0.2em;border: 1px solid grey;'>padding</span>,
      <span style='margin: 0.2em;border: 1px solid grey;'>margin</span>, id, class
      <br>Don't use: inline styles (use classes)
      <br>It must look nice...
    </p>
    <p>Read this example of <a href='http://jgthms.com/web-design-in-4-minutes/' target="_blank">styling</a> a page.
    </p>
    <p><a href='http://www.w3schools.com/css/'>W3 Schools</a> is a good reference for syntax.
      <p>
  </div>

  <div class='project'>
    <h2>task - play CSS learning games</h2>
    <a href='https://flukeout.github.io/'>CSS diner</a>: learn CSS selectors
    <br><a href='http://flexboxfroggy.com/'>Flexbox Froggy</a>: learn flexbox
    <br><a href='http://www.flexboxdefense.com/'>Flexbox Defense</a>: learn flexbox
  </div>


  <!--   ********************************************* -->
  <br>
  <a name='hosting'></a>
  <h1 class="underlined">Hosting</h1>

  <div class='task'>
    <h2>task - setup github</h2>
    <p>Make an account on <a href='https://github.com/'>github.com</a>
    </p>
    <p>Follow <a href="https://pages.github.com/">these</a> instructions to make your Gthub account a public website.</p>
    <p>Make updates to your Github public website repository as you add to your website.</p>
  </div>
  <div class='task'>
    <h2>task - add a favicon</h2>
    <p>Go to <a href='http://www.favicon.cc/'>favicon.cc</a> and make an amazing looking favicon for your site.
    </p>
    <p>Download and place the favicon.ico file in your website directory
      <br>Add this code to the head element of your index.html:
      <xmp>
        <link rel='shortcut icon' href='location/of/favicon.ico' type='image/x-icon' />
      </xmp>
    </p>
  </div>
  <div class='task'>
    <h2>task - clean up your HTML head</h2>
    <p>Read through the <a href='https://developer.mozilla.org/en-US/Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML'>Mozilla head tutorial</a>.
      <br>add any missing sections to the head of your index.html.
    </p>
  </div>
  <div class='info'>
    <h2>info - console / DevTools</h2>
    <p>Web development tools allow web developers to test and debug their code. They are different from website builders and IDEs in that they do not assist in the direct creation of a webpage, rather they are tools used for testing the user facing interface
      of a website or web application.
    </p>
    <p>Error messages and console.log("message") show up in the console. It can be accessed on chrome through the DevTools. To get to the <a href='https://developers.google.com/web/tools/chrome-devtools/'>DevTools</a> in chrome right-click on the background
      of a site and choose inspect. You can try it right now on this site, I'll wait...</p>
  </div>

  <!-- ******************************************* -->
  <br>
  <a name='js'></a>
  <h1 class="underlined">JavaScript</h1>

  <div class='task'>
    <h2>task - learn JavaScript syntax</h2>
    <p>Back to <a href='https://www.codecademy.com/'>codecademy</a> - Language Skills - <a href='https://www.codecademy.com/learn/javascript'>JavaScript</a>.
      <br>Complete the first lesson. <b>INTRODUCTION TO JAVASCRIPT</b>
    </p>
  </div>
  <div class='info'>
    <h2>info - JavaScript reference</h2>
    <a href='http://www.w3schools.com/js/'>W3 school JS</a>: tutorials and syntax
    <br><a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript'>Mozilla Developer Network</a>: advanced tutorials and syntax
    <br><a href='http://eloquentjavascript.net/'>Eloquent JavaScript</a>: online text book
  </div>
  <div class='project'>
    <h2>project - start your own JavaScript program</h2>
    <p>Build your own creative JavaScript project 
      <br><strong>or</strong> expand on one of my project ideas below
      <br><strong>or</strong> try some <a href = "https://enlight.ml/">templates</a> out
      <br><strong>or</strong> take a look at this extensive list of <a href = 'http://rosettacode.org/wiki/Category:Programming_Tasks'>programming tasks</a>.
      
    </p>
  </div>

  <div class='project'>
    <h2>project - JavaScript challenges</h2>
    <p>Fork the <a href='http://codepen.io/lilgreenland/pen/xVOdPM?editors=0010'>JavaScript challenges</a>. Add your own code to solve the problems in the comments.</p>
  </div>
  <div class='project'>
    <h2>project - random name generator</h2>
    <p>Make a new codepen that outputs random names. Follow these <a href='http://codepen.io/lilgreenland/pen/KzOjjd?editors=1010'>instructions</a>.</p>
  </div>

  <div class='project'>
    <h2>project - make a chatbot</h2>
    <p>Fork the <a href='http://codepen.io/lilgreenland/pen/pyVvqB?editors=0010'>chatbot template</a>. Edit the chatbotResponse() function to make the bot chat.</p>
  </div>
  <div class='info'>
    <h2>info - Integrated Development Environment (IDE)</h2>
    <p>JavaScript can be produced in a basic text editor, but it is faster to use an application dedicated to programming.
      <p><strong>In Browser:</strong>
        <br><a href='http://codepen.io/'>codepen</a>: simple: combines HTML, CSS, and JS</p>
      <p><strong>Text Editors:</strong>
        <br><a href='https://www.sublimetext.com/'>sublime</a>: fast, $70 (but it works without paying)
        <br><a href='https://atom.io/'>atom</a>: customizable, open source, free, by Github
  </div>

  <!--   ******************************************* -->
  <br>
  <a name='js canvas'></a>
  <h1 class="underlined">Canvas</h1>

  <div class='info'>
    <h2>info - canvas</h2>
    <p>Canvas is a html5 element that lets you draw in the browser. You can make graphics, games, interfaces, animations, whatever.</p>
    <p><a href="http://www.w3schools.com/tags/ref_canvas.asp">canvas reference</a>: w3 schools
      <br><a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API">canvas tutorials</a>: Mozilla Developer Network
      <br>
      <br><a href="http://codepen.io/lilgreenland/pen/zKVXxo?editors=0010">canvas template</a>: starter code for a canvas with inputs and animation loop
      <br><a href="http://codepen.io/lilgreenland/pen/zoZNVX?editors=0010">canvas template (full screen)</a>: same, but the canvas fills the page
      
      
    </p>
  </div>

  <div class='project'>
    <h2>project - draw a <a href="https://www.google.com/search?q=flags&rlz=1C1CHFX_enUS532US532&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjv_7ns0YLQAhUqq1QKHXyjDh8Q_AUICCgB&biw=1396&bih=725">flag</a> on canvas</h2>
  </div>

  <div class='project'>
    <h2>project - make an animation</h2>
    <p>Use <a href="https://css-tricks.com/using-requestanimationframe/">requestAnimationFrame()</a> to make things move.
    </p>
  </div>

  <div class='info'>
    <h2>info - inputs</h2>
    <p><a href="http://www.w3schools.com/tags/ref_canvas.asp">mouse events</a>: w3 schools guide
      <br><a href="http://codepen.io/lilgreenland/pen/XXamaQ?editors=0010">mouse coordinates</a>: codepen example
      <br><a href="https://css-tricks.com/snippets/javascript/javascript-keycodes/">keyboard keycodes</a>: the standard value for each key
    </p>
  </div>

  <div class='project'>
    <h2>project - make a game</h2>
    <p><a href = 'http://www.w3schools.com/graphics/game_intro.asp'>game example</a> W3 Schools.
    </p>
    <p>top view, side view, something else?
      <br>what are the controls?
      <br>what is the goal?
      <br>object oriented?
    </p>

      
    
  </div>


  <!-- ******************************************* -->
  <br>
  <a name='mobile'></a>
  <h1 class="underlined">Mobile</h1>

  <div class='info'>
    <h2>info - mobile</h2>
    <p class='listoflinks'><a href="http://codepen.io/collection/XkEeQP/">Examples: from Landgreen's codepen</a>
      <br><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">Flexbox</a>: tutorial
      <br><a href='http://www.flexboxpatterns.com/home'>Flexbox Patterns</a>: learn flexbox
      <br><a href="http://bradfrost.github.io/this-is-responsive/patterns.html">Responsive Design</a>: Examples
      <br><a href="https://developer.mozilla.org/en-US/docs/Web/API/Detecting_device_orientation">Detecting device orientation</a>
      <br><a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation">Geolocation</a>
    </p>
  </div>

  <!-- ******************************************* -->
  <br>
  <a name='lib'></a>
  <h1 class="underlined">Libraries</h1>

  <div class='info'>
    <h2>info - library ideas</h2>
    <p class="listoflinks">
      <a href="https://github.com/davidmerfield/randomColor">RandomColor.js</a>: pretty colors - (easy)
      <br><a href="http://qrohlf.com/trianglify/#gettingstarted"> Trianglify</a>: triangle art - (easy)
      <br><a href="https://github.com/mrdoob/stats.js/">stats.js</a>: frames per second tracker - (easy)
      <br><a href="http://www.chartjs.org/">Chart.js</a>: charts in canvas (<a href="http://codepen.io/lilgreenland/pen/OXbbVR">example</a>) - (medium)
      <br><a href="https://galacticmilk.com/midi-js/">MIDI.js</a>: make sounds from notes - (medium)
      <br><a href="https://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage">dat.GUI</a>: graphical user interface (<a href="http://codepen.io/lilgreenland/pen/LNjJpr">example</a>) - (medium)
      <br><a href="http://snapsvg.io/">Snap</a>: SVG graphics - (medium)
      <br><a href="http://brm.io/matter-js/">Matter.js</a>: physics engine (<a href="http://codepen.io/collection/Fuagy/">example</a>) - (hard)
      <br><a href="https://vuejs.org/">Vue.js</a>: user interface framework - (hard)
      <br>
      <br><a href="https://www.javascripting.com/">JavaScripting</a>: list of popular js libraries
    </p>
  </div>


  <!--   ******************************************* -->
  <br>
  <a name='arduino'></a>
  <h1 class="underlined">Arduino</h1>

  <div class='task'>
    <h2>task - builds #1-13</h2>
    <p>Follow the instructions in the "Experimenter's Guide for Arduino" kit
    </p>
    <p>Take a picture/video of each completed project.
      <br>Add the pictures and a short description of the project to a website on your github.
    </p>
  </div>
  <br>
  <br>
  <br>
  <br>
  <br>
  <center>
    <a href="#top" target="_self"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/464612/Bmo.png" align="middle" width="180" height="159"></center>
  </a>
  <br>
  <br>
  <br>
</article>
            
          
!
            
              /************Reset**************/

* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

html,
body,
div,
object,
iframe,
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

header,
footer,
nav,
section,
article,
hgroup,
figure {
  display: block;
}

legend {
  display: none;
}

svg:not(:root) {
  overflow: hidden;
}


/************End Reset**************/


/*global elements______________*/

body {
  font-family: "Arial", sans-serif;
  font-size: 110%;
  background-color: #64bda5;
  color: #082929;
  margin: 0;
  padding: 0em 1em 2em 1em;
}

article {
  background-color: #e0fff0;
  border: 3px solid #082929;
  border-radius: 20px;
  padding: 1.5em;
  margin: 0 auto;
  max-width: 44em;
  line-height: 1.4;
}

a {
  text-decoration: none;
  color: #ff407e;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-bottom: 3px solid #082929;
}

h1,
h2,
h3 {
  font-weight: 400;
}

::selection {
  color: white;
  background: #f16;
}

canvas {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
}


/*classes_______________________*/

.bmo {
  position: absolute;
  right: 0px;
  top: 50px;
}

@media screen and (max-width: 950px) {
  .bmo {
    display: none;
  }
}

.underlined {
  /*   font-family: "Arial Black", Gadget, sans-serif; */
  color: #062323;
  border-bottom: 3px solid #082929;
  font-size: 210%;
  /*   letter-spacing: 0.2em; */
  /*   text-align: center; */
}

.task,
.info,
.project,
.quiz {
  padding: 0em 3em 2em 3em;
}

@media screen and (max-width: 600px) {
  .task,
  .info,
  .project,
  .quiz {
    padding: 0em 0em 2em 0em;
  }
  article {
    padding: 0.5em;
  }
}


/* .info {
  border: 2px solid #082929;
  border-radius: 0px;
}
 */


/* .quiz {
  background-color: #64bda5;
  background-color: #fff;
  border-radius: 50px;
} */

#titlemain {
  font-size: 250%;
  color: #062323;
  text-align: center;
  /*   letter-spacing: 0.1em; */
  /*   text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3); */
}

.listoflinks {
  line-height: 2;
}


/* navigation bar____________________________ */

.navigation {
  /*   background-color: #54ad95; */
  margin: 0em -1em;
  list-style: none;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-flow: row wrap;
  justify-content: space-around;
}

.navigation li a {
  font-weight: bold;
  color: #082929;
  display: block;
  padding: 0;
  margin: 1em;
  font-size: 1em;
  /*   letter-spacing: 0.15em; */
}

.navigation li a:hover {
  text-decoration: none;
}


/*the element for underlines on the navbar  */

.border {
  position: relative;
}

.border:hover::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 0;
  left: 0;
  bottom: -8px;
  /*Change this to increase/decrease distance*/
  border-bottom: 5px solid #ff407e;
}
            
          
!
            
              var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
(function canvasSetup(){
  ctx.canvas.width = window.innerWidth;
  ctx.canvas.height = window.innerHeight;
  ctx.globalCompositeOperation = 'lighter';
})();
window.onresize = function() {
  canvasSetup();
};

var addStar = 0;
var stars = [];
var totalStars = 0; // spawns stars at start
var mousePos = {
  x: canvas.width * 0.5,
  y: canvas.height * 0.5
};
var friction = 0.996

//adds a new star objects to array stars
function pushStar() {
  stars.push({
    x: mousePos.x + 20 * (Math.random() - 0.5),
    y: mousePos.y + 20 * (Math.random() - 0.5),
    Vx: 0,
    Vy: 0,
    r: 35 * Math.random() + 3,  //random size
    color: '#' + Math.floor(Math.random() * 16777216).toString(16) //random hexadecimal color
  });
}
//spawns stars
for (var i = 0; i < totalStars; i++) {
  pushStar();
}
//push away if mouse down
document.addEventListener("mousedown", function() {
  addStar = 1;
  for (var i = 0; i < stars.length; i++) {
    stars[i].Vx += 3 * Math.cos(Math.atan2(stars[i].y - mousePos.y, stars[i].x - mousePos.x));
    stars[i].Vy += 3 * Math.sin(Math.atan2(stars[i].y - mousePos.y, stars[i].x - mousePos.x));
  }
});

// waits for mouse move and then updates position
document.addEventListener('mousemove', function(evt) {
  mousePos = {
    x: evt.clientX,
    y: evt.clientY
  };
}, false);

//recursive draw function
function draw() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  for (var i = 0; i < stars.length; i++) {
    //draw a circle
    ctx.beginPath();
    ctx.arc(stars[i].x, stars[i].y, stars[i].r, 0, 2 * Math.PI, true);
    ctx.fillStyle = stars[i].color;
    ctx.fill();
    //bounce off walls
    if (stars[i].x > canvas.width - stars[i].r) {
      stars[i].Vx *= -friction;
      stars[i].x = canvas.width - stars[i].r;
    } else if (stars[i].x < stars[i].r) {
      stars[i].Vx *= -friction;
      stars[i].x = stars[i].r;
    }
    if (stars[i].y > canvas.height - stars[i].r) {
      stars[i].Vy *= -friction;
      stars[i].y = canvas.height - stars[i].r;
    } else if (stars[i].y < stars[i].r) {
      stars[i].Vy *= -friction;
      stars[i].y = stars[i].r;
    }
    // attraction to the mouse
    stars[i].Vx += -0.03 * Math.cos(Math.atan2(stars[i].y - mousePos.y, stars[i].x - mousePos.x));
    stars[i].Vy += -0.03 * Math.sin(Math.atan2(stars[i].y - mousePos.y, stars[i].x - mousePos.x));
    //change position, velocity, size of object elements for each location in array
    stars[i].x += stars[i].Vx;
    stars[i].y += stars[i].Vy;
    //friction slows velocity
    stars[i].Vx *= friction;
    stars[i].Vy *= friction;
  }
  if (addStar == 1) {
    pushStar();
    addStar = 0;
  } else if (addStar == -1) {
    stars = [];
  }
  requestAnimationFrame(draw);
}
requestAnimationFrame(draw);
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console