<Anim/>
Anim コンポーネントは、Entity のアニメーション再生を有効にします。アニメーション Asset からアニメーションクリップを再生し、その再生を制御できます。
使い方
import { Entity } from '@playcanvas/react'
import { Anim, Render } from '@playcanvas/react/components'
import { useModel } from '@playcanvas/react/hooks'
const AnimatingDinosaur = (props) => {
const { asset } = useModel('/dinosaur.glb')
if (!asset) return null
return (
<Entity {...props}>
<Render type="asset" asset={asset} />
<Anim asset={asset} clip="Walk" loop />
</Entity>
)
}
PlayCanvas ドキュメントの Anim Component で詳細を確認できます。
プロパティ
| Name | Type | Default |
|---|---|---|
asset | AssetThe asset containing the animations to play. Setting this prop will automatically assign the animations to the component. | - |
stateGraphAsset? | any | - |
normalizeWeights? | booleanSets whether the animation component will normalize the weights of its layers by their sum total.
Gets whether the animation component will normalize the weights of its layers by their sum total. | - |
animationAssets? | {} | - |
speed? | numberSets the speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses
the animation.
Gets the speed multiplier for animation play back speed. | - |
activate? | booleanSets whether the first animation will begin playing when the scene is loaded.
Gets whether the first animation will begin playing when the scene is loaded. | - |
playing? | booleanSets whether to play or pause all animations in the component.
Gets whether to play or pause all animations in the component. | - |
rootBone? | EntitySets the entity that this anim component should use as the root of the animation hierarchy.
Gets the entity that this anim component should use as the root of the animation hierarchy. | - |
stateGraph? | any | - |
layerIndices? | {} | - |
parameters? | {} | - |
targets? | {} | - |
system? | ComponentSystemThe ComponentSystem used to create this Component. | - |
entity? | EntityThe Entity that this Component is attached to. | - |
enabled? | booleanSets the enabled state of the component.
Gets the enabled state of the component. | - |