繁体   English   中英

带缓存的KineticJS:如何工作?

[英]KineticJS with cache: How does it work?

我阅读了本教程,并在缓冲阶段需要帮助。 当用户单击“保存”时,我想缓存场景,包括所有拖放元素。 我真的不知道该怎么做。 如果您有任何经验,请帮忙。

您可以使用stage.toDataURL创建舞台的URL或图像

var myStage;

// have KineticJS convert the stage to a URL
stage.toDataURL({ 
  callback:imageDone
});

// callback after the URL has been created
// here we just make an image of the URL
function imageDone(stageDataURL){
  myStage=new Image();
  myStage.onload=function(){
      // your stage is now an image (myStage);
  }
  myStage.src=stageDataURL;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM