I have a codepen where I am trying to do something like Revoluts KYC doc upload verification interface.
I struggle with 2 issues.
First, I want the the application to require the image being taken within a certain area in the center of the canvas. The remainder of the canvas should have something like an rbga(0,0,0,0.3) or blurred background. I have no idea how to do this, never looked deep into canvas. SO, I want a slight overlay over the canvas, with a required targed area in the center of it where the use can take a picture of a doc.
The next thing is , I have the button on the canvas.
<button class="cta" onClick="takePhoto()">Take Photo of your ID front please</button>
I have a counter updating the count of how many images have been provided. I want the state to be incremented by 1 on every click and the innerHTML value of the CTA button to be updated accordingly. IF 3 docs have been provided, the data is being sent off to the back end etc.
const cta = document.querySelector('.cta');
let counter = 0;
This does not happen, though.
Here is the part of the function:
function takePhoto() {
// played the sound
counter += 1; // this happens
cta.innerHMTL = "" // this doesnt
if( counter === 0) { // nope
cta.innerHMTL = "Take a photo of your ID front please";
}
if( counter === 1) { //nope
cta.innerHMTL = "Take a photo of your ID back please";
}
if( counter === 2) {
cta.innerHMTL = "Please take a selfie holding the ID document";
}
Sorry for the 2 questions in one, I appreciate help on either, especially the canvas part.
Here is the codepen: