-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
192 lines (180 loc) · 6.81 KB
/
index.html
File metadata and controls
192 lines (180 loc) · 6.81 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>pixelKnit</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="i/favicon.png" type="image/x-icon">
<!-- AOS 3.0.0-beta.6 plugin CSS (Animations) -->
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css2?family=Lora:wght@100;200;300;400;500;600;700;800;900&family=Roboto:wght@100;200;300;400;500;600;700;800;900&subset=latin&display=swap"
rel="stylesheet">
<!-- Startup CSS + Bootstrap CSS (Styles for all blocks) -->
<link href="css/styles.css" rel="stylesheet" />
<!-- jQuery 3.6.0 -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> -->
</head>
<body>
<!-- Header -->
<header class="py-20 bg-bg-3">
<div class="container">
<div class="row align-items-center flex-md-row-reverse">
<div class="col-md-6">
<img src="i/sheepPxArt.png" srcset="i/sheepPxArt.png 2x" alt="" class="w-100" data-aos="fade-down"
data-aos-delay="0">
</div>
<div class="col-md-6 mt-8 mt-md-0">
<h1 class="display-3 mb-6" data-aos="fade-down" data-aos-delay="150">
Pixel to knit
</h1>
<a href="#pixelimage" class="btn btn-action-1" data-aos="fade-down" data-aos-delay="400">
Let's go!
</a>
</div>
</div>
</div>
</header>
<section class="py-10 py-md-20 bg-bg-3 text-center">
<div class="container">
<p data-aos="fade-down" data-aos-delay="0" class="fs-1 mb-4">
How this works
</p>
<h2 class="display-5 mb-6" data-aos="fade-down" data-aos-delay="150">
Take a picture
</h2>
<p class="fs-2 remove-br-sm mb-0" data-aos="fade-down" data-aos-delay="250">
Could be a photo, a photoshop montage, an icon, anything you want to try pixel to knitting in the
machine.
Upload the image and click the button. Simple as it!
</p>
</div>
</section>
<section style="visibility: hidden;">
<div class="container">
<div class="" id="">
<div class="">
<!-- greyscale -->
<label for="greyscale" class="inputbtn">Greyscale <input type="checkbox" id="greyscale"></label>
<!-- palette -->
<label for="palette" class="inputbtn">palette<input type="checkbox" id="palette"></label>
</div>
<div class="infoselects">
<!-- color palette example-->
<div class="colorpalette">
<div class="text">
<button class="" id="changepalette">Change palette</button>
</div>
<div class="icons" id="palettecolor">
</div>
</div>
</div>
</div>
</div>
</section>
<section id="pixelimage"class="py-10 py-lg-20 bg-bg-3 text-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-9 col-xl-8 col-xxl-6">
<h2 class="display-5 mb-6" data-aos="fade-down" data-aos-delay="0">
Pixel your image
</h2>
<p class="fs-2" data-aos="fade-down" data-aos-delay="250">
Upload an image to start see the changes.
</p>
<p class="" data-aos="fade-down" data-aos-delay="250">
For using in the hacked knitting machine, the image should be in black and white (don't use images with transparency).
</p>
</div>
</div>
<div class="row flex-column-reverse flex-sm-row justify-content-center align-items-center">
<div class="col-9 col-sm-6 col-md-5 col-lg-4 col-xl-3 text-sm-start">
<div class="mb-12" data-aos="fade-down" data-aos-delay="250">
<h5 class="mb-4">
<label id="uploadimage" for="pixlInput"><input type="file" class="inputbtn" id="pixlInput"></label>
</h5>
</div>
<div class="mb-12" data-aos="fade-down" data-aos-delay="500">
<h5 class="mb-4">
Block size
</h5>
<p class="mb-0">
<label for="blocksize" class="inputbtn">
<span id="blockvalue">10</span>
<input value="10" type="range" min="1" max="25" id="blocksize">
</label>
</p>
</div>
<div class="mb-12" data-aos="fade-down" data-aos-delay="750">
<h5 class="mb-4">
Max Height
</h5>
<p class="mb-0">
<label for="maxheight" class="inputbtn">
<input type="input" id="maxheight" placeholder="in px">
</label>
</p>
</div>
<div data-aos="fade-down" data-aos-delay="750">
<h5 class="mb-4">
Max Width
</h5>
<p class="mb-0">
<label for="maxwidth" class="inputbtn">
<input type="input" id="maxwidth" placeholder="in px">
</label>
</p>
</div>
<div data-aos="fade-down" data-aos-delay="1000">
<h5 class="mb-4">
</h5>
<p class="mb-0">
<Button id="downloadimage" class="btn btn-action-2">Download Image</Button>
</p>
</div>
</div>
<div class="mb-sm-0 mb-15 col-8 col-sm-6 col-md-7 col-lg-5 col-xl-5 col-xxl-4 text-md-end"
data-aos="fade-down" data-aos-delay="0">
<img src="i/yard.jpg" id="pixelitimg" class="w-100" alt="">
<canvas id="pixelitcanvas" class="w-50"></canvas>
</div>
</div>
</div>
</section>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- AOS 3.0.0-beta.6 plugin JS (Animations) -->
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<!-- Startup JS (Custom js for all blocks) - Remove ".min" if you want to edit a JS code -->
<script src="js/scripts.js"></script>
<script src="js/pixelit.js"></script>
<script>
"use strict";
const mypalette = [[0,0,0],[255,255,255]];
var px = new pixelit({
from: document.getElementById("pixelitimg"), "palette": mypalette });
document.addEventListener("DOMContentLoaded", (function () {
document.getElementById("pixlInput").onchange = function (t) {
var c = new Image;
c.src = URL.createObjectURL(this.files[0]), c.onload = function () {
px.setFromImgSource(c.src), e() } };
var e = function () {
document.querySelector(".loader").classList.toggle("active"), setTimeout((function () {
document.querySelector(".loader").classList.toggle("active") }), 500),
px.setScale(c.value).draw().pixelate().convertPalette(),
r.value && px.setMaxHeight(r.value).resizeImage(),
o.value && px.setMaxWidth(o.value).resizeImage() };
var c = document.querySelector("#blocksize"); c.addEventListener("change", (function (t) {
document.querySelector("#blockvalue").innerText = this.value, e() }));
var r = document.querySelector("#maxheight"); r.addEventListener("change", e);
var o = document.querySelector("#maxwidth"); o.addEventListener("change", e),
document.querySelector("#downloadimage").addEventListener("click", (function (e) { px.saveImage() })), e() }));
</script>
<!-- loader-->
<div class="loader">
<div class="lds-spinner">
</div>
</div>
</body>
</html>