API

MugedaAPI介绍案例已失效,求新版!

http://support.mugeda.com/?page_id=2199
木疙瘩的API文档中的时钟案例已经无法还原!
原因1,木疙瘩现在的版本已经不支持组命名中含有“_”
原因2,完全复制始终案例源代码,并且将时针的名称改为“针1”“针2”“针3”或“zhen1”“zhen2”“zhen3”均无效!
代码如下:
var mugeda = Mugeda.getMugedaObject();

mugeda.addEventListener(‘renderReady’, function () {

    var scene = mugeda.scene;

    var hourHand = scene.getObjectByName(‘zhen1’),

          minuteHand = scene.getObjectByName(‘zhen2’),

          secondHand = scene.getObjectByName(‘zhen3’);

    var updateTime = function () {

         var now = new Date(),

               sec = now.getHours() * 3600 + now.getMinutes() * 60

               + now.getSeconds() + now.getMilliseconds() / 1000;

         hourHand.rotate = sec / (6 * 3600) * Math.PI;

         minuteHand.rotate = sec / 1800 * Math.PI;

         secondHand.rotate = sec / 30 * Math.PI;

    }

    scene.addEventListener(‘enterframe’, function () {

         updateTime();

    });

});
QQ截图20160719142010.png
已邀请:

mingyue

赞同来自:

我们近期在更新所有教程文档,请耐心等待,随时关注我们

要回复问题请先登录注册