【问题标题】:Why is the animation not playing when I click on the button?I have created an animation in three js为什么我点击按钮时没有播放动画?我在三个js中创建了一个动画
【发布时间】:2017-07-06 20:18:55
【问题描述】:

我正在尝试通过单击开始按钮为框设置动画,但是当我单击开始按钮时,框不会移动。怎么了? 这是github: https://github.com/Garima5/negativeWorkDone/blob/master/index.html

【问题讨论】:

  • 控制台中有错误信息吗?

标签: javascript three.js


【解决方案1】:
<div id="info">
        <form>
            <button type="submit" id="animate" onclick="animate()">Start</button>
        </form>
</div>

保持原样

<div id="info">
    <button id="animate">Start</button>
</div>

然后在你的脚本代码中,例如,在 animate() 函数之前输入:

document.getElementById("animate").addEventListener("click", animate, false);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-01
    • 2011-12-07
    • 1970-01-01
    • 2022-01-06
    • 2020-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多