Create the right wet floor with the perspective of the image in Javascript

    In the context of one of my current projects, the task was set to make a “wet floor”. It was planned to put a huge number of pictures on the floor (but just a couple per page, with a replacement). In perspective. In perspective, by the way, temporal and spatial.

    Not finding anything worthwhile, I undertook to write my bike. And, after sitting more than two in the evening, a small js library with the generic name iWet was composed .

    UPD: Version 0.2
    • Added a white mask. See Demo.
    • I posted the source of the mask in .psd
    • He cured a bug with flickering images when loading a page
    • Added by readme.txt and license.txt
    • Minimal cosmetic code changes



    Why the developer may not be suitable for other "wet-field" solutions:
    • Need an elegant, cross-browser, fully client solution
    • The original pictures are untouchable
    • Need perspective images
    • Dissatisfaction with a canvas that builds pixel "ladders" when trying to distort perspective

    Cons, in general, also will not take long:
    • When resizing a window, the coordinates of the image reflection are not updated (yet?)
    • Transferring an image with a large number of them to the second line looks ugly
    • Image size is difficult to replace (200 × 200 by default)
    • The rendering process is visible when the page loads.
    • Inability to use a non-uniform background

    In general, see for yourself . (Press F5)

    Code is licensed under the New BSD

    Constructive criticism is welcome.

    * I dedicate a post to my father, who has DR today :)

    Also popular now: