-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (73 loc) · 3.93 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JuliaPlot</title>
<link rel="icon" href="juliaplotimg.png" type="image/x-icon" />
<link rel="stylesheet" href="styles.css" />
</head>
<body class="contain">
<script type="module" src="main.js"></script>
<div class="mainRender">
<canvas id="canvas"></canvas>
</div>
<div class="adjustBox">
<div id="equation" class="equation"> <b> W = z^2 + (0.0000 + 0.0000i) </b> </div>
<label for="power-slider">Value of the power : </label>
<input type="range" name="power-slider" value="0" id="power-slider" step="1" min="2" max="8" onchange="updateFormula()">
<div id="vector-pad" class="vector-pad">
<font class="one">(-2.0, 2.0)</font>
<font class="two">(2.0, 2.0)</font>
<font class="three">(-2.0, -2.0)</font>
<font class="four">(2.0, -2.0)</font>
<div id="horizontal-line"></div>
<div id="vertical-line"></div>
<div id="d-slider" class="d-slider"></div>
<label for="c-real-slider"></label>
<input type="range" name="c-real-slider" value="0" id="c-real-slider" step="0.0001" min="-2" max="2" onchange="updateFormula()">
<label for="c-imaginary-slider"></label>
<input type="range" name="c-imaginary-slider" value="0" id="c-imaginary-slider" step="0.0001" min="-2" max="2" onchange="updateFormula()">
</div>
<label for="hue-slider" id="hue">Hue : </label>
<input type="range" name="hue-slider" value="0" id="hue-slider" step="0.01" min="0.0" max="1.0" >
<label for="smooth-min-slider" id="smoothstepmin">SmoothStepValuesMin(shader) : </label>
<input type="range" name="smooth-min-slider" value="0.0" id="smooth-min-slider" step="0.01" min="0.0" max="1.0" >
<label for="smooth-max-slider" id="smoothstepmax">SmoothStepValuesMax(shader) : </label>
<input type="range" name="smooth-max-slider" value="1.0" id="smooth-max-slider" step="0.01" min="0.0" max="1.0" >
<label for="iteration-slider" id="iterations">Maximum Number of Iterations : 32</label>
<input type="range" name="iteration-slider" value="104" id="iteration-slider" step="10" min="32" max="1200" onchange="updateIter()" onmousedown="newOne()">
<button id="downloadButton">Save Image</button>
<div id="Time">Time taken for last render : <div id="timetime"></div></div>
<div id="info"></div>
</div>
<script>
// for updating the equation based on the present slider values
// also need to render again
function updateFormula() {
const power = document.getElementById("power-slider").value;
const real = parseFloat(document.getElementById("c-real-slider").value);
const imagine = parseFloat(document.getElementById("c-imaginary-slider").value);
var eqn = document.getElementById("equation");
eqn.innerText = `W = z${power} + (${real} + ${imagine}i)`;
}
// for updating the equation based on the present slider values
// also need to render again
function updateIter() {
const value = document.getElementById("iteration-slider").value;
var eqn = document.getElementById("iterations");
eqn.innerText = `Maximum Number of Iterations : ${value}`;
}
function newOne() {
const dslider = document.getElementById("d-slider");
const containerRect = document.getElementById("vector-pad");
const real = parseFloat(document.getElementById("c-real-slider").value);
const imagine = parseFloat(document.getElementById("c-imaginary-slider").value);
const newX = containerRect.offsetWidth*((real+2.01)/4.22);
const newY = containerRect.offsetHeight*(1 - (imagine + 2.2) / 4.2);
dslider.style.left = `${newX}px`;
dslider.style.top = `${newY}px`;
}
</script>
</body>
</html>