Skip to content

Commit 07bfa11

Browse files
committed
add RGBA useAnimation support
1 parent 908c142 commit 07bfa11

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docs/docs/lib/animation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ const CircleScene = () => {
5151

5252
In this example, `useVariable` creates position and opacity, while `useAnimation` drives a move and a fade at the same time. Use `variable.use()` in JSX styles to bind the current-frame value.
5353

54+
Supported value types for `useVariable` are `number`, `Vec2`, `Vec3`, and hex colors (`ColorHex`):
55+
56+
```tsx
57+
const opacity = useVariable(0)
58+
const pos2 = useVariable({ x: 0, y: 0 })
59+
const pos3 = useVariable({ x: 0, y: 0, z: 0 })
60+
const color = useVariable("#FFAA33CC")
61+
const colorRgb = useVariable("#FFAA33")
62+
```
63+
5464
![](./circle.gif)
5565

5666
## You can reorder awaits

docs/i18n/ja/docusaurus-plugin-content-docs/current/lib/animation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ const CircleScene = () => {
5151

5252
上の例では、`useVariable` で位置と不透明度を作り、`useAnimation` で「移動」と「フェードイン」を同時に走らせています。`variable.use()` を JSX のスタイルに使うだけで、現在フレームの値が自動で反映されます。
5353

54+
`useVariable` が受け取れる型は `number` / `Vec2` / `Vec3` / 16進カラー(`ColorHex`)です。
55+
56+
```tsx
57+
const opacity = useVariable(0)
58+
const pos2 = useVariable({ x: 0, y: 0 })
59+
const pos3 = useVariable({ x: 0, y: 0, z: 0 })
60+
const color = useVariable("#FFAA33CC")
61+
const colorRgb = useVariable("#FFAA33")
62+
```
63+
5464
![](./circle.gif)
5565

5666
## async/await で順序を入れ替えられる

0 commit comments

Comments
 (0)