首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不移除Aframe动画组件

不移除Aframe动画组件
EN

Stack Overflow用户
提问于 2016-11-18 00:43:27
回答 1查看 542关注 0票数 0

我尝试了几种方法来删除动画(从html属性本身):

代码语言:javascript
复制
element.components["animation__0"].remove(); 
//above works, but has no affect on html list, just "stops" animation.  

delete element.components.animation__0;
//works, in theory but html attribute still there

$("#id").removeAttr("animation__0");//导致以下错误:

代码语言:javascript
复制
aframe-animation-component.js:468 Uncaught TypeError: Cannot read property '2' of null(…)
getUnit @   aframe-animation-component.js:468
getValidValue   @   aframe-animation-component.js:523
getTweenValues  @   aframe-animation-component.js:584
(anonymous function)    @   aframe-animation-component.js:601
(anonymous function)    @   aframe-animation-component.js:594
getTweensProps  @   aframe-animation-component.js:592
getTweens   @   aframe-animation-component.js:614
createAnimation @   aframe-animation-component.js:755
animation   @   aframe-animation-component.js:784
update  @   aframe-animation-component.js:128
updateProperties    @   component.js:211
value   @   a-entity.js:446
value   @   a-entity.js:607
attr    @   jquery.js?hash=22a0055…:8028
removeAttr  @   jquery.js?hash=22a0055…:8068
(anonymous function)    @   jquery.js?hash=22a0055…:7991
each    @   jquery.js?hash=22a0055…:442
each    @   jquery.js?hash=22a0055…:194
removeAttr  @   jquery.js?hash=22a0055…:7990
(anonymous function)    @   VM8102:1

在删除组件等之后,我还尝试了flushToDOM() .似乎没有改变任何html

代码笔:http://codepen.io/msj121/pen/yVVmvL

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-18 08:18:12

看看你的笔叉:http://codepen.io/thoragio/pen/xRgKBQ

我用cylinder.components["animation__scale"].remove();替换了cylinder.removeAttribute("animation__scale");,而DOM现在正在更新。

另外,第一个console.log()需要在setTimeout()方法之外,否则您只是同时调用它们。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40667587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档