wh000wh000
V2EX  ›  HTML

一个 canvas 前端优化的需求

  •  
  •   wh000wh000 · Jun 8, 2018 · 4160 views
  •   You need to sign in to view this topic
    This topic created in 3016 days ago, the information mentioned may be changed or developed.

    我们使用 live2d 在一个社区替代了所有人的头像。

    这时由于一个页面存在多个 canvas,导致性能出现问题,刷新页面的时候卡顿严重,影响用户体验。

    我们 team 中的成员暂时无法有效对这个页面进行优化。 希望可以得到技术支持。

    外包形式合作。

    3 replies    2018-06-08 18:56:10 +08:00
    learnshare
        1
    learnshare  
       Jun 8, 2018
    转为 gif 插入到页面中
    luoway
        2
    luoway  
       Jun 8, 2018
    如果是静态图的话,可以限制 canvas 数目,排队使用 canvas 绘制成图片。
    由于 JS 是单线程同步执行的,一个 canvas 足够。
    LancerComet
        3
    LancerComet  
       Jun 8, 2018
    这个问题应该还算有头绪吧,楼主如果是 Live2D 2 的社区版本,你应该能看到 Demo 里的代码,它这个在业务中写的 startDraw 函数然后跑的 RAF Tick,Tick 中去调的 draw(),当你头像滚出去的时候去停止这个 RAF 就行,滚过来的时候再次启动即可,我叫雷锋 _(:3 」∠ ❀)_
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1041 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 19:04 · PVG 03:04 · LAX 12:04 · JFK 15:04
    ♥ Do have faith in what you're doing.