main v1.0
Benjamin Kraft 2 years ago
commit d796dd9a7d
  1. 1
      .gitignore
  2. 6
      project.json
  3. BIN
      public/bedrandomL.png
  4. BIN
      public/bedrandomR.png
  5. 15
      public/index.html
  6. BIN
      public/l_blue.png
  7. BIN
      public/l_green.png
  8. BIN
      public/l_rose.png
  9. BIN
      public/l_yellow.png
  10. 89
      public/main bed random.js
  11. 3400
      public/p5.dom.js
  12. 90025
      public/p5.js
  13. 12879
      public/p5.sound.js
  14. BIN
      public/r_blue.png
  15. BIN
      public/r_green.png
  16. BIN
      public/r_rose.png
  17. BIN
      public/r_yellow.png
  18. BIN
      public/thumbnail.png

1
.gitignore vendored

@ -0,0 +1 @@
.idea

@ -0,0 +1,6 @@
{
"display_name": "Bed Side-Chooser",
"info_text": "Small program written by Selina to know on which side of the bed she should sleep.",
"visible": false,
"tags": ["Tool"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Idek</title>
<style> body {padding: 0; margin: 0;} </style>
<script src="p5.js"></script>
<script src="p5.dom.js"></script>
<script src="main bed random.js"></script>
</head>
<body>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,89 @@
let imgL;
let imgR;
let imagesL = [];
let imagesR = [];
let hearts = [];
function preload() {
imgL = loadImage('bedrandomL.png');
imgR = loadImage('bedrandomR.png');
//imgLy = loadImage('l_yellow.png');
//imgRb = loadImage('r_blue.png');
imagesL[0] = loadImage('l_blue.png');
imagesL[1] = loadImage('l_green.png');
imagesL[2] = loadImage('l_rose.png');
imagesL[3] = loadImage('l_yellow.png');
imagesR[0] = loadImage('r_blue.png');
imagesR[1] = loadImage('r_green.png');
imagesR[2] = loadImage('r_rose.png');
imagesR[3] = loadImage('r_yellow.png');
}
function setup() {
createCanvas(window.innerWidth, window.innerHeight);
colorMode(HSB);
background(315, 20, 70);
angleMode(DEGREES);
imageMode(CENTER);
for(let i = 0; i < 75; i++){
hearts.push(new Heart(random(0, window.innerWidth), random(0, window.innerHeight), random(5,25), color(random(285,320),random(30,75),random(65,100))));
hearts[i].show();
}
image(imgL, window.innerWidth/4, window.innerHeight/2);
image(imgR, 3*window.innerWidth/4, window.innerHeight/2);
knopf = createButton('Wo soll Selina schlafen?');
knopf.size(250, 75)
var col = color(275, 51, 75)
knopf.style('background-color', col)
knopf.style('font-size', '15pt')
knopf.position(window.innerWidth/2 - knopf.width/2, window.innerHeight/2 - knopf.height/2);
knopf.mousePressed(entscheidung);
}
let a
function entscheidung() {
//a = Math.random() < 0.5 ? true : false
if(Math.random() < 0.5) {
a = true
} else {
a = false
}
if(a) {
image(random(imagesL), window.innerWidth/4, window.innerHeight/2)
image(imgR, 3*window.innerWidth/4, window.innerHeight/2)
} else {
image(random(imagesR), 3*window.innerWidth/4, window.innerHeight/2)
image(imgL, window.innerWidth/4, window.innerHeight/2)
}
}
class Heart {
constructor(x, y, r, c){
this.x = x;
this.y = y;
this.r = r;
this.c = c;
}
show(){
fill (this.c);
noStroke();
ellipse(this.x-23/25*this.r, this.y-10/25*this.r, 2*this.r, 2*this.r);
ellipse(this.x+23/25*this.r, this.y-10/25*this.r, 2*this.r, 2*this.r);
beginShape();
vertex(this.x, this.y-10/25*this.r);
vertex(this.x-23/25*this.r+cos(137)*this.r, this.y-10/25*this.r+sin(137)*this.r);
vertex(this.x, this.y+50/25*this.r);
vertex(this.x+23/25*this.r+cos(38)*this.r, this.y-10/25*this.r+sin(38)*this.r);
endShape(CLOSE);
}
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Loading…
Cancel
Save