Buddy’s Blog | Art, design, code, and business

Mar/10

14

Ambilight Sample; video and canvas

Sergey Chikuyonok gets his Philips Ambilight foo on as he created a HTML5 video + canvas sample that mimics the TV effect.
As the video runs, a snapshot is sent over to JavaScript land where colors are worked out:
PLAIN TEXT
JAVASCRIPT:

 

function getMidColors(side) {

        var w = buffer.width,

                h = buffer.height,

                lamps = getOption(’lamps’),

                block_width = getOption(’block_size’),

                block_height = Math.ceil(h / lamps),

                pxl = block_width * block_height * 4,

                result = [],

 

                img_data = buffer_ctx.getImageData(side == ‘right’ ? w – block_width : 0, 0, block_width, h),

                total_pixels = img_data…

Share and Enjoy:
  • email
  • Add to favorites
  • Digg
  • del.icio.us
  • LinkedIn
  • Google Bookmarks
  • Yahoo! Bookmarks
  • Facebook
  • MySpace
  • Live
  • Twitter
  • Technorati
  • StumbleUpon

RSS Feed

<<

>>