4.9 - Assign moods
Introduction
How it works
function energy(n) {
if (n < 1 / 6) {
const min = 0,
max = 1 / 6;
return {
relaxingCalm: 10,
dark: 8,
sadTense: 6,
happy: 4,
energetic: 2,
values: {
min: 0,
max: max.toFixed(2),
},
};
} else if (n < 1 / 3) {
const min = 1 / 6,
max = 1 / 3;
return {
dark: 10,
relaxingCalm: 8,
sadTense: 6,
happy: 4,
energetic: 2,
values: {
min: min.toFixed(2),
max: max.toFixed(2),
},
};
} else if (n < 2 / 3) {
const min = 1 / 3,
max = 2 / 3;
return {
sadTense: 10,
dark: 8,
happy: 6,
relaxingCalm: 4,
energetic: 2,
values: {
min: min.toFixed(2),
max: max.toFixed(2),
},
};
} else if (n < 5 / 6) {
const min = 2 / 3,
max = 5 / 6;
return {
happy: 10,
energetic: 8,
sadTense: 6,
dark: 4,
relaxingCalm: 2,
values: {
min: min.toFixed(2),
max: max.toFixed(2),
},
};
} else {
const min = 5 / 6,
max = 1;
return {
energetic: 10,
happy: 8,
sadTense: 6,
dark: 4,
relaxingCalm: 2,
values: {
min: min.toFixed(2),
max: 1,
},
};
}
}Last updated