Home › Forums › JavaScript › Making a rectangular transparent portion in a image using css and jquery › Reply To: Making a rectangular transparent portion in a image using css and jquery
August 9, 2013 at 3:11 am
#146220
Participant
You can use html5 canvas for that effect.
http://codepen.io/anon/pen/jgcAv
I used CoffeeScript which is essentially JavaScript minus “{ ( ) } ;” plus a few extra features.
You should be able to read it, otherwise use http://js2coffee.org/#coffee2js for a translation to JS. However that generates some funky loops and array stuff.
The key function is makeAHole
, which has an optional alpha value to make semi-transparent holes.