Scratch To Reveal

The ScratchToReveal component creates an interactive scratch-off effect with customizable dimensions and animations, revealing hidden content beneath.

API

Prop NameTypeDefaultDescription
classstring""The class name to apply to the component.
widthnumber""Width of the scratch container.
heightnumber""Height of the scratch container.
minScratchPercentagenumber50Minimum percentage of scratched area to be considered as completed (Value between 0 and 100).
gradientColors[string,string,string]-Gradient colors for the scratch effect.
Event NamePayloadDescription
compete-Callback function called when scratch is completed
Slot NameDefault ContentDescription
default-The text below the scratch-off ticket.

Component Code

You can copy and paste the following code to create this component:

ScratchToReveal.vue

Credits