-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add Cylinder to v4 * chore: fix playground link
- Loading branch information
1 parent
43b0648
commit befe2fc
Showing
9 changed files
with
5,280 additions
and
4,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Cylinder <Badge type="warning" text="^4.0.0" /> | ||
|
||
![](/cientos/cylinder.png) | ||
|
||
The `cientos` package provides a `<Cylinder />` component that serves as a short-cut for a `CylinderGeometry` and a `MeshBasicMaterial` with a `Mesh` object. | ||
|
||
``` | ||
args: [ | ||
radiusTop: number, | ||
radiusBottom: number, | ||
height: number, | ||
radialSegments: number, | ||
heightSegments: number, | ||
openEnded: boolean, | ||
thetaStart: number, | ||
thetaLength: number | ||
] | ||
``` | ||
|
||
Reference: [CylinderGeometry](https://threejs.org/docs/?q=cylinder#api/en/geometries/CylinderGeometry) | ||
|
||
## Usage | ||
|
||
```vue | ||
<Cylinder :args="[1, 1, 1, 32, 1, false, 0, Math.PI * 2]" color="orange" /> | ||
// Cylinder with a custom material transformations | ||
<Cylinder ref="cylinderRef" :args="[1, 1, 1, 32, 1, false, 0, Math.PI * 2]" :position="[0, 4, 0]"> | ||
<TresMeshToonMaterial color="orange" /> | ||
</Cylinder> | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script setup> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { Cylinder, OrbitControls } from '@tresjs/cientos' | ||
const { random: r, floor: fl, PI } = Math | ||
const choice = (arr) => { | ||
return arr[fl(r() * arr.length)] | ||
} | ||
const COLORS = [0x81DBC5, 0xEFAC35, 0xFFFFFF, 0x444444] | ||
const colorsArgs = Array.from({ length: 9 }).fill({}).map(() => | ||
[choice(COLORS), [r() * 0.5, r() * 0.5, r(), fl(r() * 20) + 4, fl(r() * 10) + 4, false, 0, 2 * PI]], | ||
) | ||
</script> | ||
|
||
<template> | ||
<TresCanvas | ||
window-size | ||
clear-color="#111" | ||
> | ||
<TresPerspectiveCamera | ||
:position="[0, 0, 7]" | ||
:fov="45" | ||
:aspect="1" | ||
:near="0.1" | ||
:far="1000" | ||
/> | ||
<OrbitControls /> | ||
<Cylinder | ||
v-for="[color, args], i of colorsArgs" | ||
:key="i" | ||
:args="args" | ||
:position="[i % 3 - 1, Math.floor(i / 3) - 1, 0]" | ||
> | ||
<TresMeshStandardMaterial | ||
:color="color" | ||
/> | ||
</Cylinder> | ||
<TresDirectionalLight | ||
:position="[0, 2, 4]" | ||
:intensity="2" | ||
/> | ||
<TresAmbientLight /> | ||
</TresCanvas> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.