mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
fix post slice index
This commit is contained in:
@ -4,6 +4,12 @@ date: '2022-09-02'
|
|||||||
tags: [Three.js, React]
|
tags: [Three.js, React]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<Image
|
||||||
|
src="/images/p/object-around-in-threejs/around-cover.jpg"
|
||||||
|
width="1800"
|
||||||
|
height="1201"
|
||||||
|
/>
|
||||||
|
|
||||||
使一个物体围绕另一个物体运动,主要是保证围绕物体的运动轨迹。在 three.js 中,一个 Mesh 实例可以通过其自身的 `add()` 方法,去添加另一个实例。
|
使一个物体围绕另一个物体运动,主要是保证围绕物体的运动轨迹。在 three.js 中,一个 Mesh 实例可以通过其自身的 `add()` 方法,去添加另一个实例。
|
||||||
|
|
||||||
通过此方法就可以达成添加一个实例成为另一个实例的子节点。当父节点进行运动时(例如自身旋转),子节点也会跟随运动。
|
通过此方法就可以达成添加一个实例成为另一个实例的子节点。当父节点进行运动时(例如自身旋转),子节点也会跟随运动。
|
||||||
@ -22,7 +28,7 @@ const target = new THREE.Object3D();
|
|||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
const target = new THREE.Object3D();
|
const target = new THREE.Object3D();
|
||||||
|
|
||||||
const material = new THREE.MeshPhongMaterial({
|
const material = new THREE.MeshPhongMaterial({
|
||||||
color: '#4d4d4d',
|
color: '#4d4d4d',
|
||||||
specular: '#fdfdfd',
|
specular: '#fdfdfd',
|
||||||
@ -47,9 +53,9 @@ target.add(sphere);
|
|||||||
three.scene.add(target);
|
three.scene.add(target);
|
||||||
```
|
```
|
||||||
|
|
||||||
<Image
|
<Image
|
||||||
src="/images/p/object-around-in-threejs/around.svg"
|
src="/images/p/object-around-in-threejs/around.svg"
|
||||||
alt="类型推断"
|
alt="围绕运动"
|
||||||
width="664"
|
width="664"
|
||||||
height="404"
|
height="404"
|
||||||
/>
|
/>
|
||||||
@ -81,4 +87,4 @@ earth.getWorldPosition(position);
|
|||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
<RUACodeSandbox url="https://codesandbox.io/embed/arounding-box-b1g4qq?fontsize=14&hidenavigation=1&theme=light&view=preview" />
|
<RUACodeSandbox url="https://codesandbox.io/embed/arounding-box-b1g4qq?fontsize=14&hidenavigation=1&theme=light&view=preview" />
|
||||||
|
@ -64,7 +64,7 @@ export const getStaticProps: GetStaticProps<{
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
posts: posts.slice((page - 1) * PostPerPage, PostPerPage + 1),
|
posts: posts.slice((page - 1) * PostPerPage, PostPerPage * page),
|
||||||
prev: page - 1,
|
prev: page - 1,
|
||||||
next: page + 1,
|
next: page + 1,
|
||||||
total: Math.ceil(posts.length / PostPerPage),
|
total: Math.ceil(posts.length / PostPerPage),
|
||||||
|
BIN
public/images/p/object-around-in-threejs/around-cover.jpg
Normal file
BIN
public/images/p/object-around-in-threejs/around-cover.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 KiB |
Reference in New Issue
Block a user