javascript特效代码大全 js特效教程( 三 )

< 0) ? 0 : ((nr >255) ? 255 : nr);ng = (ng < 0) ? 0 : ((ng >255) ? 255 : ng);nb = (nb < 0) ? 0 : ((nb >255) ? 255 : nb);// assign new pixel valuecanvasData.data[idx + 0] = nr; // Red channelcanvasData.data[idx + 1] = ng; // Green channelcanvasData.data[idx + 2] = nb; // Blue channelcanvasData.data[idx + 3] = 255; // Alpha channel}}},/*** mirror reflect** @param context* @param canvasData*/mirrorProcess : function(context, canvasData) {console.log("Canvas Filter - process");var tempCanvasData = https://www.520longzhigu.com/diannao/this.copyImageData(context, canvasData);for ( var x = 0; x < tempCanvasData.width; x++) // column{for ( var y = 0; y < tempCanvasData.height; y++) // row{// Index of the pixel in the arrayvar idx = (x + y * tempCanvasData.width) * 4;var midx = (((tempCanvasData.width -1) - x) + y * tempCanvasData.width) * 4;// assign new pixel valuecanvasData.data[midx + 0] = tempCanvasData.data[idx + 0]; // Red channelcanvasData.data[midx + 1] = tempCanvasData.data[idx + 1]; ; // Green channelcanvasData.data[midx + 2] = tempCanvasData.data[idx + 2]; ; // Blue channelcanvasData.data[midx + 3] = 255; // Alpha channel}}},};


以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!

「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助: