问题
How could I make waving text on a canvas element similar to what is found on this page?
回答1:
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.
回答2:
Please, for the sake of the internet, don't do it.
来源:https://stackoverflow.com/questions/2059130/waving-text-on-canvas