refactor: optimize the parameter setting logic using type assertions (#169)

This commit is contained in:
ayangweb
2025-05-01 09:57:53 +08:00
committed by GitHub
parent 95c49d85f8
commit c253853933

View File

@@ -1,3 +1,5 @@
import type { Cubism4InternalModel } from 'pixi-live2d-display'
import { Live2DModel } from 'pixi-live2d-display'
import { Application, Ticker } from 'pixi.js'
@@ -57,7 +59,9 @@ class Live2d {
}
public setParameterValue(id: string, value: number | boolean) {
return this.model?.internalModel.coreModel.setParameterValueById(id, Number(value))
const internalModel = this.model?.internalModel as Cubism4InternalModel
return internalModel.coreModel.setParameterValueById(id, Number(value))
}
}