-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsketch.js
61 lines (38 loc) · 1.28 KB
/
sketch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
title:
author: LenaMK
date: 2023-02-24
description: Titre d'œuvres d'art dans l'espace public réalisées par des femmes
notes: still buggy, looses background on click and sometimes stops. Complete random so it can show same title several times. Would have to pick random from the array, and pop the value from the array after placing it on the screen.
*/
var data
function preload() {
data = loadJSON("data.json")
}
function setup() {
colorMode(HSB, 360, 100, 100, 250);
createCanvas(windowWidth, windowHeight);
textSize(14)
frameRate(1)
background(0, 0, 0);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw() {
fill(0, 0, 100, 250)
var artwork = Math.floor(random(278))
console.log("radom value = ", artwork)
console.log("MONA id", data[artwork]["id"])
//*sans titre* est valeur par défaut
var string = "(Sans titre)"
//si on a un titre, l'écrire
if (data[artwork]["title"]["fr"] != null)
string = data[artwork]["title"]["fr"]
text(string, random(windowWidth-100), random((windowHeight-10)))
/*
for (let i = 0; i < data.length; i++){
data[i].title.fr, random(windowWidth-100), (windowHeight-10))
};
*/
}