Skip to content

Commit d82d194

Browse files
authored
Revise documentation for responsive 3D web design
Updated the description and improved clarity in the Focus Rect and ViewBox sections.
1 parent 2ba2a8d commit d82d194

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
---
2-
description: "Creating responsive 3D websites doesn't have to be complicated. This site offers practical solutions and techniques on how to seamlessly and responsively integrate 3D content into your existing web layout, specifically using three.js and the Needle Engine."
2+
description: "Learn how to easily create 3D websites that are responsive on any screen with Needle Engine and three.js"
33
---
44

55
# Responsive 3D Webdesign
66

7+
Needle Engine offers several building blocks to make building responsive 3d websites easy. Learn how to use and combine Focus Rect and ViewBox features:
8+
79
## Focus Rect
8-
The main purpose of FocusRect is to make your website responsive and ensure the 3D element is always adjusting to the available space. The 3D content moves dynamic with your existing HTML layout.
10+
Use the Needle Engine focus rect feature to adjust the center of your 3D scene using CSS. This is the basic building block for responsive layouts. It can be enabled with one line of code and no changes to your scene are required.
11+
12+
### Video Tutorial
13+
14+
<video-embed src="https://www.youtube.com/watch?v=YAPInggEIg8" limit_height />
915

10-
### How to use Focus Rect
16+
### How to use the Focus Rect
1117

12-
Set the element you like to focus on simply by querying an HTML element on your website. You then set this element using the method: [```context.setCameraFocusRect(<element>)```](https://engine.needle.tools/docs/api/classes/Engine_Core.Context.html#setcamerafocusrect).
18+
Set the element to focus on by querying an HTML element on your website. You then set this element using the [```setCameraFocusRect(<element>)```](https://engine.needle.tools/docs/api/classes/Engine_Core.Context.html#setcamerafocusrect) method.
1319

14-
For example `onStart` [hook](/scripting.md#hooks) in your Needle Engine code (e.g., in main.ts) to query the FocusRect element and pass it to the camera.
20+
For example using the `onStart` [hook](/scripting.md#hooks) in your Needle Engine code (e.g., in main.ts) to query the element and pass it to Needle Engine.
1521

1622
```ts twoslash
1723
import "@needle-tools/engine";
@@ -27,26 +33,20 @@ onStart((ctx)=>{
2733

2834
[View needle-engine attributes for more](/reference/needle-engine-attributes.md)
2935

30-
### Links to Samples
36+
### Focus Rect Samples
3137
[Demo Webpage Sword and Shield](https://portfolio-header-demo-z23hmxb19zenk-19zenk.needle.run/)
3238

3339
[Demo Webpage Bike](https://focus-rect-demo-z23hmxbztexgt-z19e07i.needle.run/)
3440

3541

36-
### Video Tutorial
37-
38-
This tutorial shows the Focus Rect workflow in action:
39-
40-
<video-embed src="https://www.youtube.com/watch?v=YAPInggEIg8" limit_height />
4142

4243
## ViewBox
4344

44-
[ViewBox](https://engine.needle.tools/docs/api/classes/Built-in_Components.ViewBox.html) can be used to automatically fit a certain box area into the camera view - no matter your screen size or aspect ratio.
45+
The [ViewBox](https://engine.needle.tools/docs/api/classes/Built-in_Components.ViewBox.html) can be used to automatically fit a certain box area into the camera view - no matter your screen size or aspect ratio.
4546

46-
This component can be used to automatically fit a certain box area into the camera view - no matter your screen size or aspect ratio.
47-
This is useful for example to frame a character or object in the center of the screen and ensure it is always fully visible. You can also animate or scale the viewbox to create zoom or framing effects.
47+
This is useful for example to frame a character or object in the center of the screen and ensure it is always fully visible. The Viewbox can also be animated or scaled to create zoom effects or to adjust the visible area.
4848

49-
### Video
49+
### ViewBox Video
5050

5151
<video-embed src="https://www.youtube.com/watch?v=Dn9lmWy3Vak" limit_height/>
5252

@@ -58,4 +58,4 @@ This is useful for example to frame a character or object in the center of the s
5858

5959
[Scrollytelling Demo using animated Viewbox](https://scrollytelling-bike-z23hmxb2gnu5a.needle.run/)
6060

61-
[Example on Stackblitz](https://stackblitz.com/edit/needle-engine-view-box-example?file=README.md)
61+
[Example on Stackblitz](https://stackblitz.com/edit/needle-engine-view-box-example?file=README.md)

0 commit comments

Comments
 (0)