Skip to content

Commit d062807

Browse files
Add more 1 example to the documentation
1 parent 10e433c commit d062807

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

docs/examples.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ folder of the documentation (/docs)".
3232
- [Spheres with center pointlight](examples/spheres-with-center-pointlight)
3333
- [Tetrahedron](examples/tetrahedron)
3434
- [Triangle with edges](examples/triangle-with-edges)
35+
- [Tube, dodecahedrons and spheres](examples/tube-dodecahedrons-and-spheres)
3536
- [Yellow line](examples/yellow-line)
3637
- [Sphere with yellow spotlight](examples/yellow-spotlight)
3738
- [Yellow triangle](examples/yellow-triangle)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<div class='center' id='graphics-container'></div>
2+
3+
<script>
4+
drawGraphics3d(
5+
document.getElementById('graphics-container'),
6+
{
7+
elements: [
8+
{
9+
type: 'tube',
10+
color: [0.2, 0.2, 0.2],
11+
coords: [
12+
[null, [0, 0, 0]],
13+
[null, [1, 0, 0]],
14+
[null, [1, 1, 0]],
15+
[null, [1, 1, 1]],
16+
[null, [1, 0, 1]],
17+
[null, [0, 0, 1]],
18+
[null, [0, 1, 1]],
19+
[null, [0, 1, 0]]
20+
],
21+
radius: 0.1
22+
},
23+
{
24+
type: 'uniformPolyhedron',
25+
color: [1, 0.5, 0.5],
26+
coords: [
27+
[[0, 0, 0]],
28+
[[2, 2, 2]]
29+
],
30+
edgeForm: { showEdges: false },
31+
opacity: 0.5, // 50% of opacity
32+
subType: 'dodecahedron'
33+
},
34+
{
35+
type: 'sphere',
36+
color: [0.5, 0.5, 1],
37+
coords: [
38+
[[0, 0, 0]],
39+
[[1, 1, 1]],
40+
[[2, 2, 2]]
41+
],
42+
edgeForm: { showEdges: false },
43+
opacity: 0.7, // 70% of opacity
44+
radius: 0.5,
45+
subType: 'dodecahedron'
46+
}
47+
],
48+
lighting: [
49+
{
50+
type: 'ambient',
51+
color: [0.5, 0.5, 0.5]
52+
},
53+
{
54+
type: 'directional',
55+
color: [0.8, 0, 0],
56+
coords: [null, [2, 0, 2]]
57+
},
58+
{
59+
type: 'directional',
60+
color: [0, 0.8, 0],
61+
coords: [null, [2, 2, 2]]
62+
},
63+
{
64+
type: 'directional',
65+
color: [0, 0, 0.8],
66+
coords: [null, [0, 2, 2]]
67+
}
68+
],
69+
viewpoint: [2, -4, 4]
70+
}
71+
);
72+
</script>

0 commit comments

Comments
 (0)