Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Michael Lai - Assignment 1 Submission #99

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Color_Palette.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Gibby.mp4
Binary file not shown.
Binary file added JohnWick.wav
Binary file not shown.
Binary file added MichaelLai.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 65 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
Assignment 1 - Hello World: Basic Deployment w/ Git, GitHub, Glitch
===
Michael Lai
http://a1-azinxtheonix.glitch.me

This project demostrates that I remember the basic elements of html, css, and javascript, as well as some clever tricks to lead to more advanced techniques. Details can be found below.

## Technical Achievements:

**1 - Style Rules:**
I'll be naming what I consider the most important style rules here (even though the style sheet has more than 5 rules).

background-color:
This is used for, of course, the background color, which changes depending on the location of the page. Used primarily for the body selector and the animation at the bottom.

color:
Very similar to background-color, but instead it's used for the text. Used primarily for the .text selector.

font-family:
Helps to set the font of all the text in the page.

td/th -> padding:
This is to make sure there's enough space for the text in the table.

.titleArea::after -> *all the style rules under this*:
This is to stop the float style rules from causing parts of the bottom section to move into the top section.

**2 - Javascript Animation:**
I've designed it so that depending on what section of the webpage you're viewing, it will change the color of the background and text. In order to accomplish this, on a scroll event, I took the current scroll position and the max scroll position in order to find a percentage, and then used that in order to do some rgb calculations. After that, I located the background color and text elements to change their colors.

Just in case that doesn't count as an animation, I made a small animation at the bottom of the page that simply bounces a square with the button toggle.

**3 - Other HTML Tags:**
First, lets go over what tags do not count for this catagory. I'm assuming all tags that are initally included do not count. These tags are: h1, h2, p, and ul/li. I'm also counting h3 -> h6 as well as any similarly functional tags.

table/tr/th/td:
I'm putting all of these tags in one catagory, as they all relate with the same function of a table.

a:
This is used for a link, which leads to something really disappointing. I can't directly describe the link, as it would ruin it, but from what I'm describing, the warning text before the link, and the modern internet, you could probably figure it out.

img:
This is for an image of myself.

video/source:
This is for a video. The tag looked interesting but I had no idea what to put in it, so I put a video of Gibby from iCarly hitting the floor.

audio:
This is for an audio file inserted into page. It's a cringe .wav file I had on my computer as a joke. I'm also slowly running out of interesting tags (with content) to use. Luckly, this is the 5th tag.


## Design Achievements:

**1 - Color palette:**
*see file named Color_Palette.jpeg*
Two of the colors are used for the first color set, two others are used for the second color set where the animation switches between the two, and the final color is used for the borders of the table. Some of the colors are used for the small backup animation at the bottom.

**2 - Google Font:**
From the linked google font, I chose Hina Mincho as the font for my site. For the Chinese characters (because why not), I chose Long Cang.


## Note: Old Readme Below

---

Assignment 1 - Hello World: Basic Deployment w/ Git, GitHub, Glitch
*DUE: Monday, August 30th by 11:59 AM (before the start of class!)*

This assignment is a "warm-up" exercise.
Expand Down Expand Up @@ -76,25 +137,11 @@ Below are some suggested technical and design achievements. You can use these to

*Design*
1. (10 points) Create a color palette using [color.adobe.com](https://color.adobe.com). Use all the colors in the palette in your webpage by implementing the appropriate CSS. Add a small screenshot of the color wheel for your color palette to your repo.
2. (5 points) Use a font from [Goolge Fonts](https://fonts.google.com) in your website.
2. (5 points) Use a font from [Google Fonts](https://fonts.google.com) in your website.

Resources
---

If you need a JavaScript/HTML/CSS refresher, see [HTML & CSS](https://wpi.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma9936730811904746&context=L&vid=01WPI_INST:Default&lang=en&search_scope=MyInst_and_CI&adaptor=Local%20Search%20Engine&tab=Everything&query=any,contains,Jon%20Duckett&offset=0) and/or [JavaScript Codeacademy](https://www.codecademy.com/en/tracks/javascript).

If you need a Git/GitHub refreseher, see [GitHub Bootcamp](https://help.github.com/categories/bootcamp/), the [GitHub Guides](https://guides.github.com/) (especially the ones on Hello World, and Understanding the GitHub Flow, and Forking Projects), and [CodeSchool's Try Git Course](https://www.codeschool.com/courses/try-git).

Sample Readme (delete the above when you're ready to submit, and modify the text below with your links and descriptions)
---

Charlie Roberts
http://a1-charlieroberts.glitch.me

This project shows ...

## Technical Achievements
- **Styled page with CSS**: Added rules for the p, li, and a selectors...

### Design Achievements
- **Used the Roboto Font from Google Fonts**: I used Roboto as the font for the primary copy text in my site.
If you need a Git/GitHub refreseher, see [GitHub Bootcamp](https://help.github.com/categories/bootcamp/), the [GitHub Guides](https://guides.github.com/) (especially the ones on Hello World, and Understanding the GitHub Flow, and Forking Projects), and [CodeSchool's Try Git Course](https://www.codeschool.com/courses/try-git).
110 changes: 110 additions & 0 deletions colorchanger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
var colorChangeOff = false;
var id = null;
var xpos = 0
var ypos = 0;
var xaccl = 1;
var yaccl = 1;
var animationOff = true;

function changeColor() {
if(colorChangeOff == false) { /* Only trigger while the animation is enabled */
/* Get the location of the scroll bar and the max scroll value;
apparently these attributes are different between browsers */
let currentPos = window.pageYOffset || document.documentElement.scrollTop;
let scrollLimit = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight,
document.documentElement.scrollHeight, document.documentElement.offsetHeight) - window.innerHeight;

let positionPercent = currentPos / scrollLimit;

/*console.log(currentPos);
console.log(scrollLimit);
console.log(positionPercent);*/

/*
Now we have to calculate the colors to show between
these colors, with the percentage we have
#fceaae (r: 252, g: 234, b:174)
#aefced (r: 174, g: 252, b:237)
*/

var red = 252 - (76 * positionPercent);
var green = 234 + (18 * positionPercent);
var blue = 174 + (63 * positionPercent);

document.getElementById("background").style.backgroundColor = rgb(red, green, blue);
/*console.log(document.getElementById("background").style.backgroundColor);*/

/*
The same calculation for text
#635527 (r: 99, g: 85, b:39)
#54c7d1 (r: 84, g: 199, b:209)
*/

var red = 99 - (15 * positionPercent);
var green = 85 + (114 * positionPercent);
var blue = 39 + (170 * positionPercent);

for(var text of document.getElementsByClassName("text")) {
text.style.color = rgb(red, green, blue);
}
}
}

function colorToggle() {
/*console.log(colorChangeOff);*/
if(colorChangeOff == false) {
document.getElementById("colorButton").innerHTML = "Enable Color Change";
colorChangeOff = true;
document.getElementById("background").style.backgroundColor = "#fceaae";
for(var text of document.getElementsByClassName("text")) {
text.style.color = "#635527";
}
} else {
document.getElementById("colorButton").innerHTML = "Disable Color Change";
colorChangeOff = false;
changeColor();
}
}

function rgb(r, g, b) {
return "rgb("+r+","+g+","+b+")";
}

function animationToggle() {
console.log("press");
if(animationOff == true) {
document.getElementById("animationButton").innerHTML = "Stop Animation";
animationOff = false;
var box = document.getElementById("animationBox");
clearInterval(id);
id = setInterval(frame, 10);

function frame() {
/*console.log(box.style.left);
console.log(box.style.top);
console.log(xpos);
console.log(ypos);
console.log(xaccl);
console.log(yaccl);*/
if(xpos == 340) {
xaccl = -1;
} else if(ypos == 195) {
yaccl = -1;
} else if(xpos == 0) {
xaccl = 1;
} else if(ypos == 0) {
yaccl = 1;
}

xpos = xpos + xaccl;
ypos = ypos + yaccl;

box.style.left = xpos + 'px';
box.style.top = ypos + 'px';
}
} else {
document.getElementById("animationButton").innerHTML = "Start Animation";
animationOff = true;
clearInterval(id);
}
}
172 changes: 153 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,160 @@
<head>
<title>CS4241 Assignment 1</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Hina+Mincho&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Long+Cang&display=swap" rel="stylesheet">
<script src="colorchanger.js"></script>
</head>
<body>
<h1>Information about [Your name here]</h1>
<p>
[Self introduction]
</p>
<p>
[Major and other information]
</p>
<p>
[Other things]
</p>

<h2>Experience</h2>
<p>
Working experience
</p>
<ul>
<li>IBM/Rational</li>
<li>WPI</li>
</ul>


<body id="background" onscroll="changeColor()">
<div class="titleArea">
<span style="float: left;">
<img class="mainImage" src="Michaellai.jpg" alt="Michael Lai" width="240">
<h1 class="mainTitle text" style='margin-left:250px;'>Information about Michael Lai (<span class="chineseName text">赖智豪</span>)</h1>
<p class="text" style='margin-left:250px; font-size: 20px;'>Computer Science (Concentration in Cybersecurity) 2022</p>
<p class="text" style='margin-left:250px;'>Kind of a gamer, not gonna lie</p>
<p class="text" style='margin-left:250px;'>By the way, do not click this link:
<a href="https://youtu.be/dQw4w9WgXcQ" target="_blank">Right Here</a>
</p>
<br><br>
<div>
<button class="text" id="colorButton" style='margin-left:10px; float: left;' onclick="colorToggle()">Disable Color Change</button>
<span class="text" style='margin-left:10px;'>*just in case you can't read the bottom sections*</p>
</div>

</span>
<span style="float: right;">
<p class="text">Play me</p>
<audio controls>
<source src="JohnWick.wav" type="audio/wav">
</audio>
<br>
<br>
<video width="320" height="240" controls>
<source src="Gibby.mp4" type="video/mp4">
</video>
</span>
</div>

<div class="experience">
<h2 class="text">Experience</h2>
<p class="text">*Also known as, the actual serious portion*</p>

<h3 class="text">Previous WPI CS Courses</h3>
<table class="text">
<tr>
<th>Course Number</th>
<th>Course Name</th>
<th>Grade</th>
</tr>
<tr>
<td>CS 1102</td>
<td>Accelerated Intro to Program Design</td>
<td>A</td>
</tr>
<tr>
<td>CS 2022</td>
<td>Discrete Mathematics</td>
<td>C</td>
</tr>
<tr>
<td>CS 2103</td>
<td>Accelerated Object-Oriented Design Concepts</td>
<td>A</td>
</tr>
<tr>
<td>CS 2011</td>
<td>Intro to Machine Organization and Assembly</td>
<td>B</td>
</tr>
<tr>
<td>CS 2303</td>
<td>Systems Programming Concepts</td>
<td>A</td>
</tr>
<tr>
<td>CS 2223</td>
<td>Algorithms</td>
<td>A</td>
</tr>
<tr>
<td>CS 3013</td>
<td>Operating Systems</td>
<td>B</td>
</tr>
<tr>
<td>CS 3733</td>
<td>Software Engineering</td>
<td>A</td>
</tr>
<tr>
<td>CS 3133</td>
<td>Foundations of Computer Science</td>
<td>A</td>
</tr>
<tr>
<td>CS 3516</td>
<td>Computer Networks</td>
<td>A</td>
</tr>
<tr>
<td>CS 3043</td>
<td>Social Implications of Information Processing</td>
<td>B</td>
</tr>
<tr>
<td>CS 4401</td>
<td>Software Security Engineering</td>
<td>B</td>
</tr>
<tr>
<td>CS 4515</td>
<td>Computer Architecture</td>
<td>A</td>
</tr>
</table>

<h3 class="text">Experience with following technologies and methods</h3>
<table class="text">
<tr>
<td>HTML</td>
<td>A lot (but rusty)</td>
</tr>
<tr>
<td>CSS</td>
<td>A lot (but rusty)</td>
</tr>
<tr>
<td>Java</td>
<td>A lot</td>
</tr>
<tr>
<td>Javascript</td>
<td>A lot (but rusty)</td>
</tr>
<tr>
<td>Ruby</td>
<td>None</td>
</tr>
<tr>
<td>Python</td>
<td>A lot</td>
</tr>
<tr>
<td>Unit Testing</td>
<td>A lot</td>
</tr>
</table>
</div>

<br>
<button id="animationButton" onclick="animationToggle()">Start Animation</button>
<br><br>
<div id="animationContainer">
<div id="animationBox"></div>
</div>
</body>
</html>
Loading