Skip to content

Commit

Permalink
add data-comp-animation page and update audio for 'state'-->'action' (#…
Browse files Browse the repository at this point in the history
…50)

Signed-off-by: hanbollar <[email protected]>
  • Loading branch information
hanbollar authored Apr 30, 2024
1 parent 2d4d665 commit 9345fa3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
35 changes: 35 additions & 0 deletions source/attributes/data-comp-animation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# data-comp-animation

```html
<mr-model src="path/to/file" data-comp-animation="action: play; loop: true"></mr-entity>
```

## `action`

Handles the animation starting and stopping.

Values: `play`, `pause`, `stop`

## `loop`

Handles how the animation loops for the model file. If set to `true`/`false` ignores the value of `loopMode`, otherwise acts as a numerical looping count.

Values: `true`, `false`, number >= 0

> if set to `true`/`false`, ignores the `loopMode` value
## `loopMode`

The format for how the looping should occur. Values are based on threejs defaults.

Values: `once`, `repeat`, and `pingpong`

> if set to `once`, ignores the `loop` value.
## `clampWhenFinished`

Freezes the animation state to the last frame when stop is called or any looping ends.

Values: `true`, `false`

> if not set, defaults to the threejs internals setup, which is `false`
6 changes: 3 additions & 3 deletions source/attributes/data-comp-audio.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# data-comp-audio

```html
<mr-entity data-comp-audio="src: path/to/file.wav; state: play; loop: true; distance: 1"></mr-entity>
<mr-entity data-comp-audio="src: path/to/file.wav; action: play; loop: true; distance: 1"></mr-entity>
```

Positional (aka Spatial) Audio can be attached to an entity using `data-comp-audio`, it has 4 values:
Expand All @@ -10,9 +10,9 @@ Positional (aka Spatial) Audio can be attached to an entity using `data-comp-aud

The path to the audio file.

## `state`
## `action`

The current state of the audio playback.
The current action state of the audio playback.

Values: `play`, `pause`, `stop` (default)

Expand Down
2 changes: 2 additions & 0 deletions source/docs/mr-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

* `src`: the path to the target model file

> Note: `data-comp-animation` can be useful here
## Supported file types

* Check out the [allowed extensions](https://docs.mrjs.io/js-api-utils/model/#modelloadmodelfilepath-extension--promisethreemesh) from the Model.loadModel function
Expand Down

0 comments on commit 9345fa3

Please sign in to comment.