danma

MENUMENU
  • Fine Art
    • Installation Art
    • Photography
    • Sculpture
    • Video
    • Wall Mounted Art
  • CV
  • Contact

Moving Pixels

January 2, 2013 by danma Leave a Comment

Pixel Manipulation

Getting the pixel data:

var imagedata = context.getImageData(x, y, width, height);

Accessing pixel components:

var pixels = [255, 0, 0, 255, 0, 0, 255,
255, 0, 0, 255, 0, 0, 255]; 

or


for (var offset = 0, len = pixels.length; offset < len; offset += 4) { var r = pixels[offset], //red g = pixels[offset + 1], //green b = pixels[offset + 2], //blue a = pixels[offset + 3], //alpha }

DEMO

DEMO

Apress. Foundation HTML5 Animation with JavaScript. N.p., n.d. Web. 02 Jan. 2013.

Related

Filed Under: HTML resources

Leave a Reply Cancel reply

Copyright © 2023 danma ::

 

Loading Comments...