亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Help canvas to draw translucent mosaic?
僅有的幸福
僅有的幸福 2017-06-07 09:24:40
0
1
1023

My requirement is to allow users to use the mouse to mosaic the uploaded documents. My idea is to bind mouse events to the canvas and draw a translucent png to the canvas along the user's mouse pressing path. On the certificate, now I don’t want to use translucent PNG overlay, I want to directly use canvas to generate mosaics, please lead the way!

僅有的幸福
僅有的幸福

reply all(1)
PHPzhong

The algorithm shouldn’t be difficult:

  1. Divide the canvas area into a 100x100 grid

  2. Every time a mouse event occurs, determine which grid the mouse is in

  3. Draw the grid directly with fillRect as the average color in the grid (average the rgb of all points in the grid, or directly take the color of a certain point in the grid)

This implements the basic algorithm of superimposed mosaic.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template