[英]"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.