How could I make waving tex开发者_如何学Ct on a canvas element similar to what is found on this page?
EDIT: @Ben, forget about the downvotes for no reason on your question, and... BE MY GUEST! :)
I never coded with <canvas>
before, it was very fun. At this point, there is no bilinear interpolation. I might rework it and add more bells and whistles.
If you want to achieve such an effect in javascript, you'll effectively have to use the <canvas>
tag.
The principle consists in precalculating a distortion function in a buffer that is larger than the source image dimension.
Have a look at the old Flipcode Art of Demomaking column: Bitmap Distortion. This is a good old gem :) The paragraph about the cache might not be relevant for a <canvas>
based implementation though.
There are many Processing resources out there, so it's also a good idea to have a look at Processing.js.
Please, for the sake of the internet, don't do it.
精彩评论