Casper Beyer
Casper Beyer

Reputation: 2301

Are CSS shaders applicable to 2d canvas?

We have "fragment" shaders in the form of CSS shaders, are these applicable/available to 2d canvas/contexts also?

Upvotes: 0

Views: 161

Answers (1)

user1693593
user1693593

Reputation:

Only to the canvas element itself, so whatever is drawn to canvas will be affected visually.

You cannot use them to process directly what you draw using the context - context is isolated to only work on the bitmap itself while CSS is limited to work on the element(s) (you could always emulate what they're doing though).

As a sidenote: there is a new filter property for the context being considered for the standard, which can take CSS filter and apply it to the context. If accepted into the standard it may be possible to use CSS shaders with context directly too - it is currently only supported in Firefox hidden behind flags. If it goes prime-time, only time will show..

Upvotes: 2

Related Questions