Hi,Kaifeng:
It's GREAT. Because weex use timer frequently . I think this method will reduce 
delay in communication   
I will add similar feature for iOS in Weex. 

Best Regards
Jerry

> 在 2017年4月6日,下午7:21,刘洋(凯冯) <kaifeng...@alibaba-inc.com> 写道:
> 
> Hi all,
> 
> 
> The typical way to create animations in JavaScript is to use setInterval() to 
> manage all animations.
> A basic animation loop using setInterval() looks like this:
> 
> 
> (function(){
> function update(){
> doAnimation(); 
> }
> setInterval(update, 1000/60);
> })();
> 
> 
> Alternatively,you can call setTimeoutrecursively to avoidexecutingJS 
> callbacks at the same time.
> 
> 
> However, the setTimeout/setIntervalfunctionality in Weex is provided by 
> WxTimerModule written in Java/Objective C.
> A setTimeout(callback, delay) function isexecuted on Android in following 
> steps:
> step 1: JS code callsetTimeout(callback, delay)
> step 2: Weex JS framework use callNative to call WxTimerModule
> step 3: Whencountdown is over,WxTimerModule use callJS toexecutecallback 
> function.
> 
> 
> Above steps include Javareflection and JNI call.If I want to run a HTML5 game 
> engine at 60fps in Weex , which means a Javareflection andJNI call will 
> beexecuted in every 17ms, theperformance is unacceptable.
> (A verysimplified html5 game demo can run at 60 fps in mobile chrome on LG 
> G5, but the fps in Weex is only 20 fps one the same phone)
> 
> 
> So here is my proposal:
> 
> 
> Provide a C++ setTimeout/setInterval/clearTimeout/clearInterval 
> implementation for Weex and register these C++ functions to V8 global object 
> as global functions. BypassJava/Objective CWxTimerModule and completely avoid 
> anyreflection and JNI call.
> 
> 
> A prototypeimplementationis realized based on the idea above and test pass.
> Performance improvements is huge. ( from 20 fps to 50 fps)
> Does anybody has comments on myproposal?
> 
> 
> 
> 
> 原始邮件
> 发件人:jerry.ssonghaiboh...@gmail.com
> 收件人:dev...@weex.incubator.apache.org
> 发送时间:2017年4月6日(周四) 17:46
> 主题:How to improve the animation in weex
> 
> 
> Hi All: If there is a lot of communication to run animation in weex. 
> animation is not smooth. Is there method to improve animation in weex? Best 
> Regards Jerry

Reply via email to