[英]"Property 'object3D' does not exist on type 'Element'" error when trying to access Element.object3D in A-frame with TypeScript
首先,我是日本学生。 所以,请原谅我糟糕的英语。 我正在开发一个框架库,现在在 TypeScript 中使用anime.js 制作动画。 当我尝试访问 Element.object3D 以更新位置值时,TypeScript 生成“Property 'object3D' does not exist on type 'Element'”错误。 这是我的代码。
function updateValue(target: Element, attr: Attribute, value: number) {
switch (attr) {
case "PositionX":
target.object3D.position.setX(value)
case "PositionY":
target.object3D.position.setY(value)
case "PositionZ":
target.object3D.position.setZ(value)
}
我意识到 Element 上不存在“object3D”,但是在导入 a-frame 时它存在。 我试图 require("aframe") 但这个问题没有解决。 对于这个问题的基本性质和我糟糕的英语,我深表歉意,但如果您能回答,我将不胜感激。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.