Entries Tagged ‘animation’:

对How JavaScript Timers Work的理解

John Resig在How JavaScript Timers Work一文中,对setTimeout和setInterval的分析很精辟:

总结如下:

  • JavaScript engines only have a single thread, forcing asynchronous events to queue waiting for execution.
  • setTimeout and setInterval are fundamentally different in how they execute asynchronous code.
  • If a timer is blocked from immediately executing it will be delayed until the next possible point of execution (which will be longer than the desired delay).
  • Intervals may execute back-to-back with no delay if they take long enough to execute (longer than the specified delay).

我的心得: 阅读全文 »

Tags: , , ,

写代码这点事儿 – 从卷帘动画的实现说起

这是淘宝懒懒交流会第二期的内容,大纲为:

  1. 布衣暖、菜根香,平淡滋味长 – 卷帘动画实例浅析
  2. 山重水复,柳暗花明 – 换个角度看世界
  3. 雄关漫道,从头越,长空西风烈 – 为了明天的偷懒
  4. 水至清则无鱼 – 完美的诠释
  5. 此中有真意 – 思想的魅力
下载:talk_on_jscode.zip (1.8M)

注意:压缩包中的杂感.txt是我在准备这个ppt时随手记录的一些想法,有些没有在ppt里体现,感兴趣的可以都看看,讨论讨论。

PS:PPT提到的直觉最终版中,所有相关的js代码请到Unicorn项目中查看: SVN Link

欢迎大家讨论交流。

Tags: , , , ,