Renamed JS folder and started learning Crystal

This commit is contained in:
plane000
2018-06-17 19:47:18 +01:00
parent 27998205c2
commit 348ba8e737
49 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>We've got some trouble | 404 - Resource not found</title>
<style type="text/css">/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}/*! Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages */body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style>
</head>
<body>
<div class="cover"><h1>Resource not found <small>Error 404</small></h1><p class="lead">The requested resource could not be found but may be available again in the future.</p></div>
<footer><p>Technical Contact: <a href="mailto:x@example.com">planeplayspc@gmail.com</a></p></footer>
</body>
</html>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>plane000 || Animation</title>
<html>
<head>
<script src="libraries/p5.js"></script>
<script src="JS/Animatething/animate.js"></script>
</script>
</head>
<body>
<a href="index.html">Return</h>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
let angle = 0;
let w = 24;
let ma;
let maxD;
function setup() {
createCanvas(400, 400, WEBGL);
ma = atan(cos(QUARTER_PI));
maxD = dist(0, 0, 200, 200);
}
function draw() {
background(100);
ortho(-400, 400, 400, -400, 0, 1000);
rotateX(-ma);
rotateY(-QUARTER_PI);
for (let z = 0; z < height; z += w) {
for (let x = 0; x < width; x += w) {
push();
let d = dist(x, z, width / 2, height / 2);
let offset = map(d, 0, maxD, -PI + 2, PI + 2);
let a = angle + offset;
let h = floor(map(sin(a), 0, 1, 100, 300));
translate(x - width / 2, 0, z - height / 2);
normalMaterial();
box(w, h, w);
pop();
}
}
angle -= 0.05;
}

View File

@@ -0,0 +1,57 @@
var bandsize = 500;
var gapsize = 50;
var position = 1;
var subtractionamount = 0;
var backgroundcol = 230;
function setup() {
createCanvas(800, 800);
background(backgroundcol);
noStroke();
fill(255, 0, 0)
arc(width / 2, height / 2, bandsize, bandsize, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(255, 69, 0);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(255, 215, 0);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(65, 105, 225);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(50, 205, 50);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(75, 0, 130);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(138, 43, 226);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
subtractionamount = gapsize * position;
position++;
fill(backgroundcol);
arc(width / 2, height / 2, bandsize - subtractionamount, bandsize - subtractionamount, PI, PI);
}
function draw() {
}

View File

@@ -0,0 +1,36 @@
function Star() {
this.x = random(-width, width);
this.y = random(-height, height);
this.z = random(width);
this.pz = this.z;
this.update = function() {
this.z = this.z - speed;
if (this.z < 1) {
this.z = width;
this.x = random(-width, width);
this.y = random(-height, height);
this.pz = this.z;
}
}
this.show = function() {
fill(255);
noStroke();
var sx = map(this.x / this.z, 0, 1, 0, width);
var sy = map(this.y / this.z, 0, 1, 0, height);
var r = map(this.z, 0, width, 4, 0);
ellipse(sx, sy, r, r);
var px = map(this.x / this.pz, 0, 1, 0, width);
var py = map(this.y / this.pz, 0, 1, 0, height);
this.pz = this.z;
stroke(255);
line(px, py, sx, sy);
}
}

View File

@@ -0,0 +1,20 @@
var stars = [];
var speed;
function setup() {
createCanvas(600, 600);
for (var i = 0; i < 800; i++) {
stars[i] = new Star();
}
}
function draw() {
speed = map(mouseX, 0, width, 0, 20);
background(0);
translate(width / 2, height / 2);
for (var i = 0; i < stars.length; i++) {
stars[i].update();
stars[i].show();
}
}

Binary file not shown.

View File

@@ -0,0 +1,41 @@
var timeleft = 10;
var startTime = 0;
var currentTime = 0;
function convertSeconds(s) {
var min = floor(s / 60);
var sec = s % 60;
return nf(min, 2) + ':' + nf(sec, 2);
}
var ding;
function preload() {
ding = loadSound("ding.mp3");
}
function setup() {
noCanvas();
startTime = millis();
var params = getURLParams();
console.log(params);
if (params.min) {
var min = params.min;
timeleft = min * 60;
}
var timer = select('#timer');
timer.html(convertSeconds(timeleft - currentTime));
var interval = setInterval(timeIt, 1000);
function timeIt() {
currentTime = floor((millis() - startTime) / 1000);
timer.html(convertSeconds(timeleft - currentTime));
if (currentTime == timeleft) {
ding.play();
clearInterval(interval);
}
}
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>plane000 || Rainbow</title>
<html>
<head>
<script src="libraries/p5.js"></script>
<script src="JS/Rainbow/Rainbow.js"></script>
</script>
</head>
<body>
<a href="index.html">Return</h>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>plane000 || Starfeild</title>
<html>
<head>
<script src="libraries/p5.js"></script>
<script src="JS/Starfeild/sketch.js"></script>
<script src="JS/Starfeild/Star.js"></script>
</script>
</head>
<body>
<a href="index.html">Return</h>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
<script language="javascript" type="text/javascript" src="libraries/p5.dom.js"></script>
<script language="javascript" type="text/javascript" src="libraries/p5.sound.js"></script>
<script language="javascript" type="text/javascript" src="JS/Timer/sketch.js"></script>
</head>
<body>
<p id="timer">______</p>
</body>
</html>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>plane000 || Home</title>
<link href="CSS/Style.css" type="text/css" rel="stylesheet" />
<html>
<body>
<a href="Rainbow.html"> Rainbow with p5.js </a>
<p>
<a href="Animation.html"> Sine wave animation with p5.js </a>
<p>
<a href="Starfeild.html"> Starfeild with p5.js </a>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long