-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cookbook): 762 recipe using tweakpane (#790)
* docs: tweakpane recipe * docs(cookbook): tweakpane recipe thumbnail
- Loading branch information
1 parent
5a063b1
commit 1081bf2
Showing
5 changed files
with
71 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: Tweakpane | ||
description: How to use tweakpane to control your scene | ||
author: alvarosabu | ||
thumbnail: /recipes/tweakpane.png | ||
difficulty: 0 | ||
--- | ||
|
||
# Tweakpane | ||
|
||
To make it easier to control the parameters of your scene, you can use [Tweakpane](https://cocopon.github.io/tweakpane/). In this guide, we will show you how to use Tweakpane to control the parameters of your scene. | ||
|
||
<StackBlitzEmbed project-id="tweakpane" /> | ||
|
||
## Installation | ||
|
||
First, you need to install Tweakpane: | ||
|
||
```bash | ||
pnpm add tweakpane | ||
``` | ||
|
||
Additionally install type defs | ||
|
||
```bash | ||
$ pnpm add -D @tweakpane/core | ||
``` | ||
|
||
## Usage | ||
|
||
In this example, we will create a simple scene with a cube and use Tweakpane to control background color and the cube material `wireframe` property. | ||
|
||
```vue | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { TresCanvas } from '@tresjs/core' | ||
import { Pane } from 'tweakpane' | ||
const state = reactive({ | ||
clearColor: '#c0ffee', | ||
wireframe: false | ||
}) | ||
const pane = new Pane() | ||
pane.addInput(state, 'clearColor') | ||
pane.addInput(state, 'wireframe') | ||
</script> | ||
<template> | ||
<TresCanvas :clear-color="state.clearColor"> | ||
<TresMesh> | ||
<TresBoxGeometry /> | ||
<TresMeshNormalMaterial :wireframe="state.wireframe" /> | ||
</TresMesh> | ||
</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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.