Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

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

#146220
dgriesel
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.