-
Notifications
You must be signed in to change notification settings - Fork 0
/
sideBySide.html
220 lines (205 loc) · 9.02 KB
/
sideBySide.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html>
<head>
<title>Multiple Visualizations on a Page</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="http://www.vizitsolutions.com/portfolio/vfield/sideBySide.html" />
<link rel="stylesheet" href="nstyle.css" type="text/css" />
<link rel="stylesheet" href="vfield.css" type="text/css" />
<link rel="prev" href="pointChargeField.html">
<link rel="next" href="interactivity.html">
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css" />
<script async src=https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js></script>
<script defer src="http://vizit.github.io/vfield/js/VField.min.js">
</script>
<script>
// This time VISUALIZATION_CONFIG is an array
var VISUALIZATION_CONFIG
= [
{
// The first entry is a simple vector field
type: "simple vector field",
// The id of the canvas we draw into
canvas: "chargeCanvasI",
scale: 5.0,
arrowSize: 1.0,
// f is a vector valued function.
f: {
type: "charge", charge: 5.0,
x: 0.0, y: 0.0, z: 0.0,
nfieldLines: 25.0
}
},
{
// The second entry is an electric field.
type: "electric field",
// The id of the canvas we draw into
canvas: "chargeCanvasII",
scale: 50.0,
lineWidth: 1.1,
arrowHeadSize: 1.0,
arrowSpacing: 15.0,
// Position a single charge at the origin
elements:
{
type: "charge", charge: 5.0,
x: 0.0, y: 0.0, z: 0.0,
fieldLineDensity: 5.0
}
}
];
</script>
</head>
<body onload="prettyPrint()">
<div class="wrapper">
<div id="main">
<div id="header">
<span class="logo2 Fell drawOnResize"><a href = "http://www.vizitsolutions.com/">Vizit Solutions</a></span>
<ul>
<li class="drawOnResize"><a href="http://www.vizitsolutions.com/portfolio/catalog/" title="Catalog">Catalog</a></li>
<li class="drawOnResize"><a href="http://www.vizitsolutions.com/portfolio/" title="Portfolio">Portfolio</a></li>
<li class="drawOnResize"><a href="http://blog.vizitsolutions.com/" title="Blog">Blog</a></li>
<li class="drawOnResize"><a href="mailto:[email protected]?subject=Vector+Fields" title="[email protected]">Contact</a></li>
</ul>
</div>
<div class="content">
<h1>Multiple Visualizations on a Page</h1>
<p id="nowebgl" class="error"></p>
<p>
We often want more than one visualization on a page. This pair contrasts
two different representations of the same field. Be careful when including
more than two WebGL components on a single page. Some mobile browsers will
only allow two WebGL components on a page at a time. They will drop earlier
components if you add more than two.
</p>
<p>
The most important difference in this example is that
<code>VISUALIZATION_CONFIG</code> is now an array of JavaScript objects
rather than a single object. A JavaScript array is generated by
surrounding the contents of the array with square brackets
<code>[ ... ]</code>.
</p>
<section class="examples">
<div class="example left">
<figure class="right">
<!--This is a canvas for our electric field visualization. -->
<canvas id="chargeCanvasI" width="300" height="300"></canvas>
<figcaption>The electric field from a point charge represented
as a vector field.</figcaption>
</figure>
</div>
<div class="example right">
<figure class="left">
<!--This is another canvas for our electric field visualization. -->
<canvas id="chargeCanvasII" width="300" height="300"></canvas>
<figcaption>The electric field from a point charge represented
by field lines.</figcaption>
</figure>
</div>
</section>
<h3>Include VField</h3>
<pre class="prettyprint"><code class="language-js">
<script defer src=http://vizit.github.io/vfield/js/VField.min.js>
</script>
</code></pre>
<p>
We continue to draw examples from only the <a href
= "https://github.com/VizIT/vfield">VField</a> package.
We will include another package soon.
</p>
<h3>Configure the visualization</h3>
<pre class="prettyprint"><code class="language-js">
<script>
// This time VISUALIZATION_CONFIG is an array
var VISUALIZATION_CONFIG
= [
{
// The first entry is a simple vector field
type: "simple vector field",
// The id of the canvas we draw into
canvas: "chargeCanvasI",
scale: 5.0,
arrowSize: 1.0,
// f is a vector valued function.
f: {
type: "charge", charge: 5.0,
x: 0.0, y: 0.0, z: 0.0,
nfieldLines: 25.0
}
},
{
// The second entry is an electric field.
type: "electric field",
// The id of the canvas we draw into
canvas: "chargeCanvasII",
scale: 50.0,
lineWidth: 1.1,
arrowHeadSize: 1.0,
arrowSpacing: 15.0,
// Position a single charge at the origin
elements:
{
type: "charge", charge: 5.0,
x: 0.0, y: 0.0, z: 0.0,
fieldLineDensity: 5.0
}
}
];
</script>
</code></pre>
<p>
This new configuration contains both of the prior examples. Each
of the examples is an entry in the array (<code>[ ... ]</code>)
which makes up the new configuration. Each entry renders to a
different canvas, the first to <code>chargeCanvasI</code>, and
the second to <code>chargeCanvasII</code>. Other than that these
are the same as the previous two examples.
</p>
<h3>Give a place to draw</h3>
<pre class="prettyprint"><code class="language-html">
<section class="examples">
<div class="example left">
<figure class="right">
<!--This is a canvas for our electric field visualization. -->
<canvas id="chargeCanvasI" width="300" height="300"></canvas>
<figcaption>The electric field from a point charge represented
as a vector field.</figcaption>
</figure>
</div>
<div class="example right">
<figure class="left">
<!--This is another canvas for our electric field visualization. -->
<canvas id="chargeCanvasII" width="300" height="300"></canvas>
<figcaption>The electric field from a point charge represented
by field lines.</figcaption>
</figure>
</div>
</section>
</code></pre>
<p>
A way of displaying visualizations in side by side figures. You are, of
course, free to integrate the visualizations into your content to best
suite your objectives. This is only one of many possibilities. You might
be curious about <a href = "vfield.css">the CSS for this section</a> as well.
</p>
<p>
Next, we return to the first example, the field from a point charge, and add
more <a href = "interactivity.html">interactivity</a>. This showcases the small
building block approach, how it is able to integrate into your content, and
allows you to express your style of content.
</p>
<div class="center license">
<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource"
property="dct:title" rel="dct:type">VField Documentation</span> by <a xmlns:cc="http://creativecommons.org/ns#"
href="http://www.vizitsolutions.com/" property="cc:attributionName" rel="cc:attributionURL">Vizit Solutions</a>
is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons
Attribution 4.0 International License</a>.
</div>
</div>
<script src="../../js/vizit.js"></script>
</div>
</div>
</body>
</html>