Created
April 18, 2017 00:08
-
-
Save outoftime/5dd13b8a8854a6007d75a998c28a3829 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=5dd13b8a8854a6007d75a998c28a3829
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Page Title</title> | |
| <script defer src="https://cdn.rawgit.com/outoftime/c405972c7971f291af983729b23ba862/raw/2f1a97e9068947571dab7fea4413fe62d2520107/starter.js"></script> | |
| </head> | |
| <body> | |
| <img src="http://vignette3.wikia.nocookie.net/prehistoricpark/images/5/59/Running-cheetah.jpg/revision/latest?cb=20140616041414" id="cheetah" class="animal"> | |
| <img src="https://upwithmarc.files.wordpress.com/2015/05/gazelle-image-01.jpg" id="gazelle" class="animal"> | |
| </body> | |
| </html> |
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
| {"enabledLibraries":["jquery"]} |
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
| // We did this one for you. Notice that y can never get bigger | |
| // than 4, because there are only five spaces on the board. | |
| function moveDown(y) { | |
| if (y === 4) { | |
| return 4; | |
| } | |
| return y + 1; | |
| } | |
| // 1. There’s a function here, but it doesn’t do the right thing. | |
| // Fix this function so that: | |
| // it returns 0 if y is 0 | |
| // otherwise, it returns one less than y | |
| function moveUp(y) { | |
| return y; | |
| } | |
| // 2. Define a function called moveLeft, that accepts one | |
| // parameter, called x. This function should: | |
| // return 0 if x is 0 | |
| // otherwise, it returns one less than x | |
| // 3. Define a function called moveRight, that accepts one | |
| // parameter, called x. This function should update the | |
| // X coordinate to move the cheetah one to the right, but | |
| // should not allow the cheetah to go off the board. | |
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
| .animal { | |
| width: 20vw; | |
| position: absolute; | |
| transition: top 1s, left 1s; | |
| } | |
| body { | |
| height: 100vh; | |
| width: 100vw; | |
| background: url(https://aos.iacpublishinglabs.com/question/62effd5619c14bf044a7157ae4cc25bc/aq/700px-394px/country-savannah-located_383120e7b4c44e35_IEAyywjJRfO0sSv2SLUiyw.jpg?domain=cx.aos.ask.com) no-repeat; | |
| background-size: cover; | |
| } | |
| #cheetah { | |
| top: 0; | |
| left: 0; | |
| z-index: 1; | |
| } | |
| #gazelle { | |
| top: 80vw; | |
| left: 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment