Skip to content

Instantly share code, notes, and snippets.

View junlas's full-sized avatar

junlas junlas

  • YaoYao
  • Austria
View GitHub Profile
@junlas
junlas / ImgBase64.js
Created June 8, 2018 08:38
截屏获取image base64字符串
// 返回 image base64
getImgBase64() {
let sp = cc.find('Canvas/New Sprite(Splash)').getComponent(cc.Sprite);
let target = cc.find('Canvas');
let width = 960,
height = 640;
let renderTexture = new cc.RenderTexture(width, height);
renderTexture.begin();
target._sgNode.visit();
renderTexture.end();
@junlas
junlas / DomAudioGroup.js
Last active March 2, 2018 05:23
Dom Audio 以及 Web Audio 在微信网页上的播放管理工具类(自动播放,不需要点击播放)
import WeixinAudio from "../weixin/WeixinAudio";
import WeixinUtils from "../weixin/WeixinUtils";
export default class DomAudioGroup {
_audioUrl = null;
_endCallback = null;
_domAudio = null;
@junlas
junlas / platform.js
Last active January 25, 2018 07:58
微信小游戏平台数据接口 - 基于Promise异步形式封装
class WxgamePlatform {
name = 'Cat';
_bgmAudio = null;
login() {
return new Promise((resolve, reject) => {
wx.login({
success:res=> {
resolve(res)
@junlas
junlas / AudioGoup.js
Last active March 19, 2020 02:01
彻底解决在微信环境下自动播放声音
export default class AudioGroup {
_imgUrl = null;
_mp3Url = null;
_autoPlay = false;
/**@type {Function} */
_onPlayCompleteCallback = null;
/**@type {boolean} */
_isUseDomAudio;
spriteFrame;