Changes to project structure
This commit is contained in:
parent
7d71c4bfda
commit
fb63da2836
51 changed files with 801 additions and 586 deletions
68
pandoc/shark.js
Normal file
68
pandoc/shark.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<script>
|
||||
let speed = 10;
|
||||
let scale = 0.33; // Image scale (I work on 1080p monitor)
|
||||
let canvas;
|
||||
let ctx;
|
||||
let logoColor;
|
||||
|
||||
let dvd = {
|
||||
x: 256,
|
||||
y: 354,
|
||||
xspeed: 2,
|
||||
yspeed: 2,
|
||||
img: new Image()
|
||||
};
|
||||
|
||||
(function main(){
|
||||
canvas = document.getElementById("tv-screen");
|
||||
ctx = canvas.getContext("2d");
|
||||
dvd.img.src = 'images/shark.png';
|
||||
|
||||
//Draw the "tv screen"
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
|
||||
pickColor();
|
||||
update();
|
||||
})();
|
||||
|
||||
function update() {
|
||||
setTimeout(() => {
|
||||
//Draw the canvas background
|
||||
ctx.fillStyle = '#00000000';
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
//Draw DVD Logo and his background
|
||||
//ctx.fillStyle = logoColor;
|
||||
//ctx.fillRect(dvd.x, dvd.y, dvd.img.width*scale, dvd.img.height*scale);
|
||||
ctx.drawImage(dvd.img, dvd.x, dvd.y, dvd.img.width*scale, dvd.img.height*scale);
|
||||
//Move the logo
|
||||
dvd.x+=dvd.xspeed;
|
||||
dvd.y+=dvd.yspeed;
|
||||
//Check for collision
|
||||
checkHitBox();
|
||||
update();
|
||||
}, speed)
|
||||
}
|
||||
|
||||
//Check for border collision
|
||||
function checkHitBox(){
|
||||
if(dvd.x+dvd.img.width*scale >= canvas.width || dvd.x <= 0){
|
||||
dvd.xspeed *= -1;
|
||||
pickColor();
|
||||
}
|
||||
|
||||
if(dvd.y+dvd.img.height*scale >= canvas.height || dvd.y <= 0){
|
||||
dvd.yspeed *= -1;
|
||||
pickColor();
|
||||
}
|
||||
}
|
||||
|
||||
//Pick a random color in RGB format
|
||||
function pickColor(){
|
||||
r = Math.random() * (254 - 0) + 0;
|
||||
g = Math.random() * (254 - 0) + 0;
|
||||
b = Math.random() * (254 - 0) + 0;
|
||||
|
||||
logoColor = 'rgb('+r+','+g+', '+b+')';
|
||||
}
|
||||
</script>
|
||||
|
|
@ -22,7 +22,7 @@ $endif$
|
|||
$styles.html()$
|
||||
</style>
|
||||
$for(css)$
|
||||
<link rel="stylesheet" href="$css$" />
|
||||
<link rel="stylesheet" href="$css$">
|
||||
$endfor$
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
|
|
@ -37,18 +37,7 @@ $endif$
|
|||
<body>
|
||||
<canvas id="tv-screen"></canvas>
|
||||
<header id="page-header">
|
||||
<ul>
|
||||
<li><a href="index.html">Home</a></li><li><a href="about.html">About</a></li>
|
||||
</ul>
|
||||
<!--
|
||||
<ul>
|
||||
<li>
|
||||
<span id="dark-mode">
|
||||
<input id="dark-mode-toggle" type="checkbox"><label for="dark-mode-toggle">Dark mode</label>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
<ul><li><a href="index.html">Home</a></li></ul>
|
||||
</header>
|
||||
$for(include-before)$
|
||||
$include-before$
|
||||
|
|
@ -87,41 +76,40 @@ $body$
|
|||
</article>
|
||||
$if(articles)$
|
||||
<nav id="articles">
|
||||
<h2>Articles</h2>
|
||||
<ul>
|
||||
$for(articles)$
|
||||
<li>
|
||||
<div class="articles-header">
|
||||
$if(articles.title)$
|
||||
<a href="$articles.filename$.html" class="articles-title">$articles.title$</a>
|
||||
$endif$
|
||||
$if(articles.author)$
|
||||
<p class="articles-author"><em>$articles.author$</em></p>
|
||||
$endif$
|
||||
</div>
|
||||
$if(articles.summary)$
|
||||
<p class="articles-summary">$articles.summary$</p>
|
||||
$endif$
|
||||
$if(articles.date)$
|
||||
<p class="articles-date">$articles.date$</p>
|
||||
$endif$
|
||||
</li>
|
||||
$endfor$
|
||||
</ul>
|
||||
<h2>Articles</h2>
|
||||
<ul>
|
||||
$for(articles)$
|
||||
<li>
|
||||
<div class="articles-header">
|
||||
$if(articles.title)$
|
||||
<a href="$articles.filename$.html" class="articles-title">$articles.title$</a>
|
||||
$endif$
|
||||
$if(articles.author)$
|
||||
<p class="articles-author"><em>$articles.author$</em></p>
|
||||
$endif$
|
||||
</div>
|
||||
$if(articles.summary)$
|
||||
<p class="articles-summary">$articles.summary$</p>
|
||||
$endif$
|
||||
$if(articles.date)$
|
||||
<p class="articles-date">$articles.date$</p>
|
||||
$endif$
|
||||
</li>
|
||||
$endfor$
|
||||
</ul>
|
||||
</nav>
|
||||
$endif$
|
||||
|
||||
</section>
|
||||
$for(include-after)$
|
||||
$include-after$
|
||||
$endfor$
|
||||
<footer id="page-footer">
|
||||
<!-- <embed type="text/html" src="https://cups.teabucket.eu/embed?from=never" style="width:320px; height: 120px; scale: 0.66;"> -->
|
||||
<p class="cups-light">
|
||||
<a href="https://cups.teabucket.eu/prev?from=never" target="_parent"><img alt="Previous" src="images/cups_left.svg" width="30" height="30/"></a>
|
||||
<a href="https://cups.teabucket.eu/" target="_parent"><img alt="CUPS" src="images/cups_logo.svg" width="120" height="60/"></a>
|
||||
<a href="https://cups.teabucket.eu/next?from=never" target="_parent"><img alt="Next" src="images/cups_right.svg" width="30" height="30/"></a>
|
||||
</p>
|
||||
<!-- <embed type="text/html" src="https://cups.teabucket.eu/embed?from=never" style="width:320px; height: 120px; scale: 0.66;"> -->
|
||||
<p class="cups-light">
|
||||
<a href="https://cups.teabucket.eu/prev?from=never" target="_parent"><img alt="Previous" src="images/cups_left.svg" width="30" height="30"></a>
|
||||
<a href="https://cups.teabucket.eu/" target="_parent"><img alt="CUPS" src="images/cups_logo.svg" width="120" height="60"></a>
|
||||
<a href="https://cups.teabucket.eu/next?from=never" target="_parent"><img alt="Next" src="images/cups_right.svg" width="30" height="30"></a>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue