fix splash screen webgl at alipay (#6103)

* fix splash screen webgl viewport for alipay

* fix splash screen webgl at alipay
This commit is contained in:
jiaxin.lai
2020-01-14 19:27:40 +08:00
committed by pandamicro
parent a7a8cdbd05
commit e4f2db7d9e
+10 -1
View File
@@ -334,8 +334,14 @@ export class SplashScreenWebgl {
const elapsedTime = time - this.startTime;
const precent = clamp01(elapsedTime / this.setting.totalTime);
const alpha = easing.cubicOut(precent);
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.clearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
gl.depthMask(true);
gl.clearDepth(1);
@@ -344,6 +350,9 @@ export class SplashScreenWebgl {
gl.useProgram(this.program);
var resolutionLocation = gl.getUniformLocation(this.program, "u_resolution");
gl.uniform2f(resolutionLocation, gl.canvas.width, gl.canvas.height);
let location = gl.getUniformLocation(program, "u_alpha");
gl.uniform1f(location, alpha);