Options
All
  • Public
  • Public/Protected
  • All
Menu

ImageScript GIF

ImageScript GIF

const logo = Image.load('http://is-editor.dreadful.tech/logo.png');
if(logo.width > 512) logo.resize(512, Image.RESIZE_AUTO);
if(logo.height > 512) logo.resize(Image.RESIZE_AUTO, 512);

const frames = [];
for(let i = 0; i < 30; i++) {
    const frame = Frame.from(logo.clone(), 100);
    frame.fill((x,y) => (logo.getPixelAt(x,y) & 0xff) ? Image.hslToColor(i / 30, 1, 0.5) : 0);
    frames.push(frame);
}

const image = new GIF(frames);

Functions used

Image.load
Image#resize
Image#clone
Frame.from
Image#getPixelAt
Image.hslToColor
new GIF