Skip to content

Commit

Permalink
add initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
thombach committed Jun 12, 2022
1 parent 65c7183 commit 0b09ca7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
Binary file added assets/airplane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions contrail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var planeImg = document.createElement('img');
planeImg.src = 'assets/airplane.png';
planeImg.id = 'plane';
document.getElementById('contrailCanvas').appendChild(planeImg);

let x = 0, y= 0;
var planeAnim = setInterval(movePlane, 5);


function movePlane() {
var plane = document.getElementById('plane');
plane.style.left = x + "px";
x++;
}
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Contrail.js</title>
<link rel="stylesheet" href="main.css"></link>
</head>
<body>

<div id="contrailCanvas"></div>
<script src="contrail.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
html, body {
width: 100%;
height: 100%;
margin: 0;
}

#contrailCanvas {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}

#plane {
position: absolute;
width: 20px;
height: 20px;
}

0 comments on commit 0b09ca7

Please sign in to comment.