ビデオコントロール
説明
このコンポーネントにより、エン ティティはマテリアルに適用されたテクスチャのビデオ再生を制御できる。 これは、Studioコンフィギュレーターでビデオが設定されると自動的に追加されます。 プログラムでビデオを追加する場合、再生コントロールを有効にするには、このコンポーネントを手動で追加する必要がある。
プロパティ
プロパティ | タイプ | デフォルト | 説明 |
---|---|---|---|
url (必須) | ストリング | '' | ビデオのソースURL |
ボリューム | 番号 | 1 | ビデオの再生音量 0から1の間の値 |
ループ | ブーリアン | 擬似 | ビデオ終了後に再起動するかどうか |
休止中 | ブーリアン | 擬似 | 動画が一時停止中かどうか |
スピード | 番号 | 1 | ビデオの再生速度。 オーディオのピッチにも影響する |
ポジション | ブーリアン | 擬似 | ビデオの音声を位置的に再生するかどうか |
反射距離 | 番号 | 1 | **音声が小さくなり始める距離。 負でない値でなければならない |
距離モデル | ストリング | '逆' | **この映像ソースとリスナーとの距離が離れるにつれて音量を下げるために使用されるアルゴリズム。 オプション'linear'、'inverse'、'exponential' |
ロールオフ係数 | 番号 | 1 | **positionalがtrueの場合のみ適用され ます。**距離が長くなるにつれて、体積が減少する速さ。 許容範囲は距離によって異なるモデル:線形:0-1、逆数:0-∞、指数:0-∞。 |
最大距離 | 番号 | 10000 | positionalがtrueでdistanceModelが'linear'の場合のみ適用される。 この距離を超えると、音量はそれ以上小さくならない。 正の値でなければならない |
機能
Get
Returns a read-only reference.
Example
ecs.VideoControls.get(world, component.eid)
Set
Ensures the component exists on the entity, then assigns the (optional) data to the component.
Example
ecs.VideoControls.set(world, component.eid, {
url: './assets/video.mp4',
volume: 1,
loop: false,
paused: false,
speed: 1,
positional: false,
refDistance: 1,
distanceModel: ''inverse'',
rolloffFactor: 1,
maxDistance: 10000
})
Mutate
Perform an update to the component within a callback function. Return true
to indicate no changes made.
Example
ecs.VideoControls.mutate(world, component.eid, (cursor) => {
cursor.volume = 0.5;
cursor.loop = true;
return false;
})
Remove
Removes the component from the entity.
Example
ecs.VideoControls.remove(world, component.eid)
Has
Returns true
if the component is present on the entity.
Example
ecs.VideoControls.has(world, component.eid)
Reset
Adds, or resets the component to its default state.
Example
ecs.VideoControls.reset(world, component.eid)
Advanced Functions
Cursor
Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.
Example
ecs.VideoControls.cursor(world, component.eid)
Acquire
Same behavior as cursor, but commit must be called after the cursor is done being used.
Example
ecs.VideoControls.acquire(world, component.eid)
Commit
Called after acquire. An optional third argument determines whether the cursor was mutated or not.
Example
ecs.VideoControls.commit(world, component.eid)
ecs.VideoControls.commit(world, component.eid, false)
Dirty
Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.
Example
ecs.VideoControls.dirty(world, component.eid)