Skip to content

Instantly share code, notes, and snippets.

View ydaniv's full-sized avatar

Yehonatan Daniv ydaniv

View GitHub Profile
@ydaniv
ydaniv / duotone.js
Created August 20, 2019 11:23
Introducing Kampos examples :: duotone simplified
export default function () {
return {
fragment: {
uniform: {
u_light: 'vec3',
u_dark: 'vec3'
},
main: `vec3 gray = vec3(dot(lumcoeff, color));
color = mix(u_dark, u_light, gray);`
uniforms: [
@ydaniv
ydaniv / ticker-full.js
Created August 20, 2019 11:24
Introducing Kampos examples :: ticker full
import {Kampos, effects, Ticker} from 'kampos';
const target1 = document.querySelector('#canvas1');
const media1 = document.querySelector('#video1');
const target2 = document.querySelector('#canvas2');
const media2 = document.querySelector('#video2');
const hueSaturation = effects.hueSaturation();
const brightnessContrast = effects.brightnessContrast();
@ydaniv
ydaniv / ticker-simple.js
Created August 20, 2019 11:25
Introducing Kampos Examples :: ticker simple
import {Kampos, effects, Ticker} from 'kampos';
const ticker = new Ticker();
const kampos = new Kampos({target, effects: [effects.hueSaturation()], ticker});
const kampos2 = new Kampos({target2, effects: [effects.hueSaturation()], ticker});
// rest of drawing logic ...
ticker.start();