@ -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"] |
||||||
|
} |
After Width: | Height: | Size: 10 KiB |
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> |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.2 KiB |
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);
|
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 139 KiB |