A Pen by lilgreenland on CodePen.
Last active
October 18, 2016 11:49
-
-
Save lilgreenland/4e2512847f6af5082279aedc3351c93c to your computer and use it in GitHub Desktop.
CS class: Assignments 2017-2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>Back to <a href='http://landgreen.github.io/' >Mr. Landgreen's</a> home page</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> | |
<!-- ****************************************** --> | |
<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 | |
</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='task'> | |
<h2>project - Start Your Own JavaScript Project</h2> | |
<p>Build your own creative JavaScript project <br><strong>or</strong> expand on one of my templates below.</p> | |
</div> | |
<div class='task'> | |
<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='task'> | |
<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='task'> | |
<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 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, popular, $70 (but it works without paying) | |
<br><a href='https://atom.io/'>atom</a>: newer, customizable, open source, free, by Github | |
</div> | |
<!-- ******************************************* --> | |
<br> | |
<a name='js canvas'></a> | |
<h1 class="underlined">Canvas</h1> | |
<div class='task'> | |
<h2>task - make a video game on canvas</h2> | |
<p><a href="https://developer.mozilla.org/en-US/docs/Games/Techniques/Control_mechanisms/Desktop_with_mouse_and_keyboard">inputs</a> | |
<br>physics: sidescroller or topview | |
<br>player objects | |
<br>game objects | |
</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="http://www.w3schools.com/html/html_responsive.asp">Responsive Design</a> | |
<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> | |
<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"><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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.getElementById("myCanvas"); | |
var ctx = canvas.getContext("2d"); | |
ctx.canvas.width = window.innerWidth; | |
ctx.canvas.height = window.innerHeight; | |
//ctx.globalAlpha = 0.5+Math.random()*0.5; | |
switch (Math.ceil(Math.random() * 7)) { | |
case 1: | |
ctx.globalCompositeOperation = 'darken'; | |
break; | |
case 2: | |
ctx.globalCompositeOperation = 'lighter'; | |
break; | |
case 3: | |
ctx.globalCompositeOperation = 'source-over'; | |
break; | |
case 4: | |
ctx.globalCompositeOperation = 'lighter'; | |
break; | |
case 5: | |
ctx.globalCompositeOperation = 'darker'; | |
break; | |
} | |
var addStar = 0; | |
var container = { | |
x: 0, | |
y: 0, | |
width: canvas.width, | |
height: canvas.height | |
}; | |
var stars = []; | |
var totalStars = 0; // spawns stars at start | |
var mousePos = { | |
x: container.width * 0.5, | |
y: container.height * 0.5 | |
}; | |
var friction = 0.996 | |
window.onresize = function(event) { | |
ctx.canvas.width = window.innerWidth; | |
ctx.canvas.height = window.innerHeight; | |
container.height = window.innerHeight; | |
container.width = window.innerWidth; | |
}; | |
function score() { | |
ctx.font = "15px Arial"; | |
ctx.fillStyle = "#333"; | |
ctx.textAlign = "end"; | |
ctx.fillText(stars.length, container.width - 50, container.height-50); | |
} | |
//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, | |
color: '#' + Math.floor(Math.random() * 16777216).toString(16) | |
}); | |
} | |
//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)); | |
} | |
}); | |
//gets mouse position | |
function getMousePos(canvas, evt) { | |
var rect = canvas.getBoundingClientRect(); | |
return { | |
x: evt.clientX - rect.left, | |
y: evt.clientY - rect.top | |
}; | |
} | |
// waits for mouse move and then updates position | |
document.addEventListener('mousemove', function(evt) { | |
mousePos = getMousePos(canvas, evt); | |
}, false); | |
//recursive draw function | |
function draw() { | |
ctx.clearRect(container.x, container.y, container.width, container.height); | |
score(); | |
for (var i = 0; i < stars.length; i++) { | |
//draw a circle | |
ctx.globalCompositeOperation = 'darker'; | |
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 > container.width - stars[i].r) { | |
stars[i].Vx *= -friction; | |
stars[i].x = container.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 > container.height - stars[i].r) { | |
stars[i].Vy *= -friction; | |
stars[i].y = container.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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdnjs.cloudflare.com/ajax/libs/snap.svg/0.4.1/snap.svg-min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************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.0em; | |
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; | |
} | |
::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-weight: 400; | |
font-size: 210%; | |
letter-spacing: 0.2em; | |
/* text-align: center; */ | |
} | |
.task, | |
.info, | |
.project, | |
.quiz { | |
padding: 0.5em; | |
margin: 1.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; | |
} | |
.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; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment