Skip to content

Commit b71c5cf

Browse files
"Officialize" renaming of examples classes to addons (mrdoob#24579)
* "Officialize" renaming of examples classes to addons * Fix * Fix spaces Co-authored-by: Marco Fugaro <[email protected]> * Fix spaces again * Update README.md Co-authored-by: Marco Fugaro <[email protected]>
1 parent ebc97eb commit b71c5cf

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#### JavaScript 3D library
1010

11-
The aim of the project is to create an easy to use, lightweight, cross-browser, general purpose 3D library. The current builds only include a WebGL renderer but WebGPU (experimental), SVG and CSS3D renderers are also available in the examples.
11+
The aim of the project is to create an easy to use, lightweight, cross-browser, general purpose 3D library. The current builds only include a WebGL renderer but WebGPU (experimental), SVG and CSS3D renderers are also available as addons.
1212

1313
[Examples](https://threejs.org/examples/) &mdash;
1414
[Docs](https://threejs.org/docs/) &mdash;

docs/manual/en/introduction/Installation.html

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ <h2>Install from CDN or static hosting</h2>
6464

6565
<p>
6666
The three.js library can be used without any build system, either by uploading files to your own web server or by using an existing CDN. Because the library relies on ES modules, any script that references it must use <em>type="module"</em> as shown below.
67-
It is also required to define an Import Map which resolves the bare module specifier `three`.
67+
It is also required to define an import map which resolves the bare module specifier `three`.
6868
</p>
6969

7070
<code>
@@ -88,42 +88,53 @@ <h2>Install from CDN or static hosting</h2>
8888
</code>
8989

9090
<p>
91-
Since Import maps are not yet supported by all browsers, it is necessary to add the polyfill *es-module-shims.js*.
91+
Since import maps are not yet supported by all browsers, it is necessary to add the polyfill *es-module-shims.js*.
9292
</p>
9393

94-
<h2>Examples</h2>
94+
<h2>Addons</h2>
9595

9696
<p>
97-
The core of three.js is focused on the most important components of a 3D engine. Many other useful components — such as controls, loaders, and post-processing effects — are part of the [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm examples/jsm] directory. They are referred to as "examples," because while you can use them off the shelf, they're also meant to be remixed and customized. These components are always kept in sync with the core library, whereas similar third-party packages on npm are maintained by different people and may not be up to date.
97+
The core of three.js is focused on the most important components of a 3D engine. Many other useful components — such as controls, loaders, and post-processing effects — are part of the [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm examples/jsm] directory. They are referred to as "addons" (previously called "examples"), because while you can use them off the shelf, they're also meant to be remixed and customized. These components are always kept in sync with the core library, whereas similar third-party packages on npm are maintained by different people and may not be up to date.
9898
</p>
9999

100100
<p>
101-
Examples do not need to be <em>installed</em> separately, but do need to be <em>imported</em> separately. If three.js was installed with npm, you can load the [page:OrbitControls] component with:
101+
Addons do not need to be <em>installed</em> separately, but do need to be <em>imported</em> separately. If three.js was installed with npm, you can load the [page:OrbitControls] component with:
102102
</p>
103103

104-
105104
<code>
106105
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
107106

108107
const controls = new OrbitControls( camera, renderer.domElement );
109108
</code>
110109

111110
<p>
112-
If three.js was installed from a CDN, use the same CDN to install other components:
111+
If three.js was installed from a CDN, use the same code, but with `three/addons/` in the import map.
113112
</p>
114113

115114
<code>
115+
&lt;script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js">&lt;/script>
116+
117+
&lt;script type="importmap">
118+
{
119+
"imports": {
120+
"three": "https://unpkg.com/three@&lt;version&gt;/build/three.module.js",
121+
"three/addons/": "https://unpkg.com/three@&lt;version&gt;/examples/jsm/"
122+
}
123+
}
124+
&lt;/script>
125+
116126
&lt;script type="module">
117127

118-
import { OrbitControls } from 'https://unpkg.com/three@&lt;version&gt;/examples/jsm/controls/OrbitControls.js';
128+
import * as THREE from 'three';
129+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
119130

120131
const controls = new OrbitControls( camera, renderer.domElement );
121132

122133
&lt;/script>
123134
</code>
124135

125136
<p>
126-
It's important that all files use the same version. Do not import different examples from different versions, or use examples from a different version than the three.js library itself.
137+
It's important that all files use the same version. Do not import different addons from different versions, or use addons from a different version than the three.js library itself.
127138
</p>
128139

129140
<h2>Compatibility</h2>

0 commit comments

Comments
 (0)