Add flaglike waving to 2d Context

前端 未结 2 1882
野性不改
野性不改 2021-01-21 21:37

I want to make a function that displays a 2d context in a different way than usual. Sort of like the transform works. Instead of curving/changing the size of the context I want

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 22:32

    You could optimize with shaders so that the workload is transfered to GPU, but that's 3d/webgl context.

    As for 2d, you'll just have to do it on per-pixel level, there's no other way.

    And if by this

    The idea is that this has to come from the context

    you mean: to have objects that are transformed by some oscillating force, then you should look for physics engine: box2djs comes to mind.

    p2.js has a nice demo with springs.

提交回复
热议问题