/**
 * Copyright(c) Live2D Inc. All rights reserved.
 *
 * Use of this source code is governed by the Live2D Open Software license
 * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
 */ import { CubismIdHandle } from '../id/cubismid' ; import { CubismModel } from '../model/cubismmodel' ; import { csmVector } from '../type/csmvector' ; /**
 * 呼吸機能
 *
 * 呼吸機能を提供する。
 */ export class CubismBreath { /**
     * インスタンスの作成
     */ public static create ( ) { return new CubismBreath ( ) ; } param instance public static delete ( instance ) { if ( instance != null ) { instance = null ; } } param breathParameters public setParameters ( breathParameters ) { this . _breathParameters = breathParameters ; } return public getParameters ( ) { return this . _breathParameters ; } param model param deltaTimeSeconds public updateParameters ( model , deltaTimeSeconds ) { this . _currentTime += deltaTimeSeconds ; const t = this . _currentTime * 2.0 * 3.14159 ; for ( let i = 0 ; i < this . _breathParameters . getSize ( ) ; ++ i ) { const data = this . _breathParameters . at ( i ) ; model . addParameterValueById ( data . parameterId , data . offset + data . peak * Math . sin ( t / data . cycle ) , data . weight ) ; } } /**
     * コンストラクタ
     */ public constructor ( ) { this . _currentTime = 0.0 ; } _breathParameters : csmVector < BreathParameterData > ; _currentTime : number ; } /**
 * 呼吸のパラメータ情報
 */ export class BreathParameterData { param parameterId param offset param peak param cycle param weight constructor ( parameterId ? , offset ? , peak ? , cycle ? , weight ? ) { this . parameterId = parameterId == undefined ? null : parameterId ; this . offset = offset == undefined ? 0.0 : offset ; this . peak = peak == undefined ? 0.0 : peak ; this . cycle = cycle == undefined ? 0.0 : cycle ; this . weight = weight == undefined ? 0.0 : weight ; } parameterId : CubismIdHandle ; offset : number ; peak : number ; cycle : number ; weight : number ; } import * as $ from './cubismbreath' ; export namespace Live2DCubismFramework { export const BreathParameterData = $ . BreathParameterData ; export type BreathParameterData = $ . BreathParameterData ; export const CubismBreath = $ . CubismBreath ; export type CubismBreath = $ . CubismBreath ; }