-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
110 lines (86 loc) · 2.58 KB
/
scripts.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
function chooseItem(arr, location) {
// for (var i = 0; i < arguments.length; i++){
// console.log(arguments[i]);
// }
// data.array.forEach(element => {
// location.push(element);
// });
var ind = randomInt(0, arr.length-1);
location.push(arr[ind]);
}
$(function() {
var newHeight = "8em";
// setup arrays of data
const array1 = [
"Midtempo", "Slow",
"Fast", "Very Fast",
"Very Slow", "Rubato",
"Atempo", "Rising & Falling"
];
const array2 = [
"Upbeat", "Melancholy",
"Heroic", "Villainous",
"Romantic", "Inspirational",
"Pensive", "Ambient",
"Horror", "Ambiguous",
"Mysterious", "Lonely",
"Nostalgic", "Fanfare",
"Main theme", "Redemptive",
"Failure", "Victorious",
"Quirky", "Goofy",
"Fighting", "Regret",
"Wishful", "Hopeful",
];
const array3 = [
"Orchestral", "Electronic",
"Hybrid", "Impressionist",
"Piano", "Band",
];
const array4 = [
"Big film score", "Modern VG",
"16-bit VG", "8-bit VG",
"Indie film score",
];
var values = [];
// init arrays for possible items
// init "other array" to hold the values we randomly choose
// add items to arrays
$("#generator").click(function() {
// for 0.5-1s:
// change grow spinner to spinny spinner
// shrink button
//$("#generator").removeClass("zoom");
$("#buttonBox").css('transform', 'scale(' + 0 + ')');
$("#generator").animate({opacity: "0%"}, 200);
setTimeout(() => {
// hide button section and space
$("#space1").animate({ height: newHeight }, 50);
$("#buttonBox").collapse("dispose")
}, 210);
// show the new stuff
setTimeout(() => {
$("#newContent").collapse("show");
}, 300);
// randomly choose an item from each array
chooseItem(array1, values);
chooseItem(array2, values);
chooseItem(array3, values);
chooseItem(array4, values);
// output values
for (var i=0; i<values.length; i++) {
var id = "#item" + i;
$(id).text(values[i]);
}
//$("#prompt").text(str);
//alert(str);
// include button for generating new prompt
});
$("#reload").click(function() {
$("#main").animate({opacity: "0%"}, 300, function() {
location.reload();
});
});
});