B
B
Bogdan2019-03-12 15:14:13
JavaScript
Bogdan, 2019-03-12 15:14:13

Canvas Brightness?

Hello. Due to the fact that Safari does not support context.filter, you need to somehow implement your filters (brightness and contrast), I googled the solution ,
but somehow it does not work at all like context.filter, which brightens the light color more progressively than the dark one, and custom implementation brightens evenly.
5c87a25daf017360728607.png
Can you please tell me how to achieve the desired result? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2019-03-12
@bogdan_uman

From the description at https://developer.mozilla.org/en-US/docs/Web/API/C...

brightness()
A CSS <percentage>. Applies a linear multiplier to the drawing, making it appear brighter or darker. A value under 100% darkens the image, while a value over 100% brightens it. A value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged.

It turns out that brightness should work something like this:
https://codepen.io/anon/pen/jJaNoQ?editors=1010

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question