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
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.