-
Notifications
You must be signed in to change notification settings - Fork 14
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
moneppo's assignment #14
Open
moneppo
wants to merge
4
commits into
bfl-itp:gh-pages
Choose a base branch
from
moneppo:gh-pages
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>moneppo's Instructional Assignment</title> | ||
<link rel="stylesheet" type="text/css" href="main.css"> | ||
</head> | ||
<body> | ||
<canvas id="canvas" width="400" height="400"></canvas> | ||
<img class="part head" src="images/head.jpeg"></img> | ||
<img class="part arm" src="images/arm.jpeg"></img> | ||
<img class="part arm" src="images/arm.jpeg"></img> | ||
<img class="part leg" src="images/leg.jpeg"></img> | ||
<img class="part leg" src="images/leg.jpeg"></img> | ||
<script src="zepto.min.js"></script> | ||
<script src="zepto.dragdrop.min.js"></script> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>So-and-so's Instructional Assignment</title> | ||
<title>moneppo's Instructional Assignment</title> | ||
<link rel="stylesheet" type="text/css" href="main.css"> | ||
</head> | ||
<body> | ||
YOUR CODE HERE | ||
<canvas id="canvas" width="400" height="400"></canvas> | ||
<img class="part head" src="images/head.jpeg"></img> | ||
<img class="part arm" src="images/arm.jpeg"></img> | ||
<img class="part arm" src="images/arm.jpeg"></img> | ||
<img class="part leg" src="images/leg.jpeg"></img> | ||
<img class="part leg" src="images/leg.jpeg"></img> | ||
<script src="zepto.js"></script> | ||
<script src="zepto.dragdrop.js"></script> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
Zepto(function($){ | ||
var $canvas = $('#canvas'); | ||
var $parts = $('.part'); | ||
var ctx = $canvas[0].getContext('2d'); | ||
|
||
var none = []; | ||
var parts = []; | ||
|
||
var attached = [false,false,false,false,false]; | ||
|
||
var bucket = 0; | ||
function draw() { | ||
ctx.drawImage(none[bucket], 0, 0); | ||
for (var i = 0; i < attached.length;i++) { | ||
if (attached[i]) { | ||
ctx.drawImage(parts[i][bucket], 0,0); | ||
} | ||
} | ||
} | ||
|
||
function mouseMove(e) { | ||
var x = (e.pageX - $canvas.offset().left) / $canvas.width(); | ||
bucket = Math.floor(x * 5) - 2; | ||
if (bucket < -2) bucket = -2; | ||
if (bucket > 2) bucket = 2; | ||
draw(); | ||
} | ||
|
||
function loadImages(update, then) { | ||
var count = 0; | ||
var totalImages = 30; | ||
|
||
function imageLoaded() { | ||
count++; | ||
update(count / totalImages); | ||
if (count == totalImages) { | ||
then(); | ||
} | ||
} | ||
|
||
// Load backgrounds | ||
for (var p = -2; p <= 2; p++) { | ||
var filename = 'images/img' + p + 'none.jpeg'; | ||
var img = new Image(); | ||
none[p] = img; | ||
img.onload = imageLoaded; | ||
img.src = filename; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a descriptive comment for a section of code like this is usually a sign to move it into a helpfully-named function 😉 |
||
|
||
for (var i = 0; i < 5; i++) { | ||
parts[i] = []; | ||
for (var p = -2; p <= 2; p++) { | ||
var filename = 'images/img' + i + p + '.png'; | ||
var img = new Image(); | ||
parts[i][p] = img; | ||
img.onload = imageLoaded; | ||
img.src = filename; | ||
} | ||
} | ||
} | ||
|
||
loadImages( | ||
function(amount) { | ||
|
||
}, | ||
function() { | ||
$canvas.on('mousemove', mouseMove); | ||
draw(); | ||
|
||
$parts.draggable({ | ||
start: function () { | ||
this.css('-webkit-transform', 'scale(2)'); | ||
}, | ||
stop: function () { | ||
this.css('-webkit-transform', 'scale(1)'); | ||
} | ||
}); | ||
|
||
$canvas.droppable({ | ||
drop: function (e, dragEl, dropEl) { | ||
if(dragEl.hasClass('head')) { | ||
attached[0] = true; | ||
} | ||
|
||
if(dragEl.hasClass('arm')) { | ||
if (attached[1]) { | ||
attached[2] = true; | ||
} else attached[1] = true; | ||
} | ||
|
||
if(dragEl.hasClass('leg')) { | ||
if (attached[3]) { | ||
attached[4] = true; | ||
} else attached[3] = true; | ||
} | ||
|
||
dragEl.hide(); | ||
draw(); | ||
|
||
return true; | ||
} | ||
}); | ||
} | ||
); | ||
}); | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#canvas { | ||
padding-left: 0; | ||
padding-right: 0; | ||
padding-top: 5%; | ||
margin-left: auto; | ||
margin-right: auto; | ||
display: block; | ||
width: 400px; | ||
} | ||
|
||
body { | ||
background-color: #AAA; | ||
} | ||
|
||
.part { | ||
float: left; | ||
} |
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you've found the Gruntfile, mind excluding Zepto and any other 3rd-party libraries from linting? Will make the Travis output more intelligible.