+ 2
[SOLVED] Why the image got dimmer after the animation?
Hi there! I was working on a code to animate the Indian flag. I tried to draw the image in the form of thin slits displaced along the y-axis by some length (similar to water waves). But, after the animation, the image got dimmer. Why it is so? Thanks in advance! Edit: Added the code https://code.sololearn.com/WmP6CuzCPFta/?ref=app
5 ответов
+ 6
Rahul , I don't know if you already solved the problem but I'll answer it anyway.
The problem is on line 32, in the drawImage function, you set the dWidth to 0.5 which is only half of the slit width.
That draws only half of a slit and leaves a margin between slits. That's why the brightness looks reduced.
You should set it to 1.
Upon testing, the animation looks pixelated at the top and bottom. Try using 0.9 or anything close to 1 to reduce pixelation.
+ 3
Please provide the code with you. Otherwise we have no idea what could have made that happen.
+ 3
Jonathan Pizarra Oh, the 0.5, that's why the brightness seems to be reduced.
Thanks a lot!
+ 1
Rahul you're welcome. Just a correction on my answer, The 0.5 dWidth doesn't draw only half of a slit. It actually draws the whole slit but compressed by half.👍