JSFiddle - React, Tailwind, and code Playground

by Dinesh Gurjar

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- canvas -->
<h1>
canvas
</h1>
<canvas id="canvas" width="300" height="300" ></canvas>
<br>
<div ><input type="button" id="button" value="origional" />
<input type="button" id="button1" value="blur" />
<input type="button" id="button2" value="brightness" /> 
<input type="button" id="button3" value="contrast" /> 
<input type="button" id="button4" value="grayscale" /> 
<input type="button" id="button5" value="huerotate" /> 
<input type="button" id="button6" value="invert" /> 
<input type="button" id="button7" value="opacity" /> 
<input type="button" id="button8" value="saturate" /> 
<input type="button" id="button9" value="sepia" /> 
<input type="button" id="button10" value="shadow" />  
</div>
<br>
<!-- image -->
<h1>
image
</h1>
<img id="origional" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img id="blur" class="blur" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img class="brightness" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img class="contrast" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img class="grayscale" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img class="huerotate" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img class="invert" src="https://lh5.googleusercontent.com/-bSF6HLBpWZU/AAAAAAAAAAI/AAAAAAAAABI/6UVYOKY6QhE/photo.jpg" alt="Pineapple" width="300" height="300">
<img...

CSS

img {
    width: 33%;
    height: auto;
    float: left;
}
.origional {filter:none;}
.blur {-webkit-filter: blur(4px);filter: blur(4px);}
.brightness {-webkit-filter: brightness(0.30);filter: brightness(0.30);}
.contrast {-webkit-filter: contrast(180%);filter: contrast(180%);}
.grayscale {-webkit-filter: grayscale(100%);filter: grayscale(100%);}
.huerotate {-webkit-filter: hue-rotate(180deg);filter: hue-rotate(180deg);}
.invert {-webkit-filter: invert(100%);filter: invert(100%);}
.opacity {-webkit-filter: opacity(50%);filter: opacity(50%);}
.saturate {-webkit-filter: saturate(7); filter: saturate(7);}
.sepia {-webkit-filter: sepia(100%);filter: sepia(100%);}
.shadow {-webkit-filter: drop-shadow(8px 8px 10px green);filter: drop-shadow(8px 8px 10px green);}

JavaScript

//origional canvas image
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    var img = document.getElementById("origional");
   ctx.drawImage(img, 0, 0,300,300);
   
   $('#button').click(function() {
    canvas.classList.add("origional");
    canvas.classList.remove("blur");
    canvas.classList.remove("brightness");
    canvas.classList.remove("contrast");
    canvas.classList.remove("grayscale");
    canvas.classList.remove("huerotate");
    canvas.classList.remove("invert");
    canvas.classList.remove("opacity");
    canvas.classList.remove("saturate");
    canvas.classList.remove("sepia");
    canvas.classList.remove("shadow");
});

   $('#button1').click(function() {
    canvas.classList.add("blur");
    canvas.classList.remove("origional");
    canvas.classList.remove("brightness");
    canvas.classList.remove("contrast");
    canvas.classList.remove("grayscale");
    canvas.classList.remove("huerotate");
    canvas.classList.remove("invert");
    canvas.classList.remove("opacity");
    canvas.classList.remove("saturate");
    canvas.classList.remove("sepia");
    canvas.classList.remove("shadow");
});

   $('#button2').click(function() {
    canvas.classList.add("brightness");
    canvas.classList.remove("blur");
    canvas.classList.remove("origional");
    canvas.classList.remove("contrast");
    canvas.classList.remove("grayscale");
    canvas.classList.remove("huerotate");
    canvas.classList.remove("invert");
    canvas.classList.remove("opacity");
    canvas.classList.remove("saturate");
    canvas.classList.remove("sepia");
    canvas.classList.remove("shadow");
});
   $('#button3').click(function() {
    canvas.classList.add("contrast");
    canvas.classList.remove("blur");
    canvas.classList.remove("brightness");
    canvas.classList.remove("origional");
    canvas.classList.remove("grayscale");
    canvas.classList.remove("huerotate");
    canvas.classList.remove("invert");
   ...