forked from med-art/MindArtMaster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterface-line.js
103 lines (81 loc) · 2.1 KB
/
interface-line.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
let resetButton, saveButton, homeButton, fsButton, toggleBut;
let toggle = 0;
var colours = [
['#F2B705', '#701036'],
['#0D0D0D', '#0D0D0D'],
['#F2B077', '#023E73'],
['#D94929', '#590902'],
['#F2B705', '#02735E'],
['#F2B705', '#011F26'],
['#F2B705', '#A6600A'],
['#F2B705', '#1450A4'],
['#F2B705', '#363432']
];
let cc = 0;
function calcDimensions() {
if (width > height) {
vMax = width / 100;
} else {
vMax = height / 100;
}
}
function writeTextUI() {
// TODO: REMOVE ELEMENTS
$(".interface").remove();
$('#interface').on("touchstart", function(event){
event.preventDefault();
}, {passive: false});
$('#interface').on("click", function(event){
event.preventDefault();
}, {passive: false});
// UI elements
// Buttons on the right..
homeButton = createButton('Main Menu');
homeButton.position(width - (13 * vMax),height - (20 * vMax));
homeButton.class('right-buttons');
homeButton.mousePressed(menu);
resetButton = createButton('New');
resetButton.position(width - (13 * vMax),height - (14 * vMax));
resetButton.class('right-buttons');
resetButton.mousePressed(next);
saveButton = createButton('Save');
saveButton.position(width - (13 * vMax),height - (8 * vMax));
saveButton.class('right-buttons');
saveButton.mousePressed(saveImg);
createSwatch();
}
function createSwatch() {
$(".box").remove();
$(".toggle").remove();
swatch = [];
for (let i = 0; i < 2; i++) {
swatch[i] = createButton("");
swatch[i].size(7 * vMax, 10.5 * vMax);
swatch[i].style("background-color", colours[cc][i]);
swatch[i].style("border-width", '6px');
swatch[i].class("box");
swatch[i].id("swatch" + i);
}
}
function left_colour() {
bool = 0;
resetButtons();
toggle = false;
click.play();
}
function right_colour() {
bool = 0;
resetButtons();
toggle = true;
click.play();
}
function paintOff() {
for (let i = 0; i < 2; i++) {
swatch[i].position(((i * 9) + 12) * vMax, height - (11 * vMax));
swatch[i].size(9 * vMax, 8 * vMax);
}
}
function saveImg() {
click.play();
save('linescape' + month() + day() + hour() + second() + '.jpg');
}