function (clearAll, clearColor) {
        var dom = this.dom;
        var ctx = this.ctx;
        var width = dom.width;
        var height = dom.height;

        var clearColor = clearColor || this.clearColor;
        var haveMotionBLur = this.motionBlur && !clearAll;
        var lastFrameAlpha = this.lastFrameAlpha;

        var dpr = this.dpr;

        if (haveMotionBLur) {
            if (!this.domBack) {
                this.createBackBuffer();
            }

            this.ctxBack.globalCompositeOperation = 'copy';
            this.ctxBack.drawImage(
                dom, 0, 0,
                width / dpr,
                height / dpr
            );
        }

        ctx.clearRect(0, 0, width, height);
        if (clearColor && clearColor !== 'transparent') {
            var clearColorGradientOrPattern;
            // Gradient
            if (clearColor.colorStops) {
                // Cache canvas gradient
                clearColorGradientOrPattern = clearColor.__canvasGradient || Style.getGradient(ctx, clearColor, {
                    x: 0,
                    y: 0,
                    width: width,
                    height: height
                });

                clearColor.__canvasGradient = clearColorGradientOrPattern;
            }
            // Pattern
            else if (clearColor.image) {
                clearColorGradientOrPattern = Pattern.prototype.getCanvasPattern.call(clearColor, ctx);
            }
            ctx.save();
            ctx.fillStyle = clearColorGradientOrPattern || clearColor;
            ctx.fillRect(0, 0, width, height);
            ctx.restore();
        }

        if (haveMotionBLur) {
            var domBack = this.domBack;
            ctx.save();
            ctx.globalAlpha = lastFrameAlpha;
            ctx.drawImage(domBack, 0, 0, width, height);
            ctx.restore();
        }
    }
function (clearAll, clearColor) {
        var dom = this.dom;
        var ctx = this.ctx;
        var width = dom.width;
        var height = dom.height;

        var clearColor = clearColor || this.clearColor;
        var haveMotionBLur = this.motionBlur && !clearAll;
        var lastFrameAlpha = this.lastFrameAlpha;

        var dpr = this.dpr;

        if (haveMotionBLur) {
            if (!this.domBack) {
                this.createBackBuffer();
            }

            this.ctxBack.globalCompositeOperation = 'copy';
            this.ctxBack.drawImage(
                dom, 0, 0,
                width / dpr,
                height / dpr
            );
        }

        ctx.clearRect(0, 0, width, height);
        if (clearColor && clearColor !== 'transparent') {
            var clearColorGradientOrPattern;
            // Gradient
            if (clearColor.colorStops) {
                // Cache canvas gradient
                clearColorGradientOrPattern = clearColor.__canvasGradient || Style.getGradient(ctx, clearColor, {
                    x: 0,
                    y: 0,
                    width: width,
                    height: height
                });

                clearColor.__canvasGradient = clearColorGradientOrPattern;
            }
            // Pattern
            else if (clearColor.image) {
                clearColorGradientOrPattern = Pattern.prototype.getCanvasPattern.call(clearColor, ctx);
            }
            ctx.save();
            ctx.fillStyle = clearColorGradientOrPattern || clearColor;
            ctx.fillRect(0, 0, width, height);
            ctx.restore();
        }

        if (haveMotionBLur) {
            var domBack = this.domBack;
            ctx.save();
            ctx.globalAlpha = lastFrameAlpha;
            ctx.drawImage(domBack, 0, 0, width, height);
            ctx.restore();
        }
    }
function ( clearAll , clearColor ) { var dom = this . dom ; var ctx = this . ctx ; var width = dom . width ; var height = dom . height ; var clearColor = clearColor || this . clearColor ; var haveMotionBLur = this . motionBlur && ! clearAll ; var lastFrameAlpha = this . lastFrameAlpha ; var dpr = this . dpr ; if ( haveMotionBLur ) { if ( ! this . domBack ) { this . createBackBuffer ( ) ; } this . ctxBack . globalCompositeOperation = 'copy' ; this . ctxBack . drawImage ( dom , 0 , 0 , width / dpr , height / dpr ) ; } ctx . clearRect ( 0 , 0 , width , height ) ; if ( clearColor && clearColor !== 'transparent' ) { var clearColorGradientOrPattern ; // Gradient if ( clearColor . colorStops ) { // Cache canvas gradient clearColorGradientOrPattern = clearColor . __canvasGradient || Style . getGradient ( ctx , clearColor , { x : 0 , y : 0 , width : width , height : height } ) ; clearColor . __canvasGradient = clearColorGradientOrPattern ; } // Pattern else if ( clearColor . image ) { clearColorGradientOrPattern = Pattern . prototype . getCanvasPattern . call ( clearColor , ctx ) ; } ctx . save ( ) ; ctx . fillStyle = clearColorGradientOrPattern || clearColor ; ctx . fillRect ( 0 , 0 , width , height ) ; ctx . restore ( ) ; } if ( haveMotionBLur ) { var domBack = this . domBack ; ctx . save ( ) ; ctx . globalAlpha = lastFrameAlpha ; ctx . drawImage ( domBack , 0 , 0 , width , height ) ; ctx . restore ( ) ; } }
清空该层画布
@param {boolean} [clearAll]=false Clear all with out motion blur
@param {Color} [clearColor]
清空该层画布
Clear the image