Slide 1

Slide 1 text

Houdini

Slide 2

Slide 2 text

Houdini

Slide 3

Slide 3 text

Typed Object Model

Slide 4

Slide 4 text

Typed Object Model $('#element').styleMap .set('opacity', new CSSNumberValue(0.5)); $('#element').styleMap .set('height', new CSSSimpleLength(50, 'px'));

Slide 5

Slide 5 text

Typed Object Model $('#element').styleMap .set('height', new CSSSimpleLength(50, 'px')); $('#element').styleMap .get('height').value; // 50 $('#element').styleMap .get('height').type; // ‘px’

Slide 6

Slide 6 text

Typed Object Model $('#element').styleMap .set('height', new CSSCalcLength('50vh - 20px')); $('#element').styleMap.get('height').vh; // 50 $('#element').styleMap.get('height').px; // -20

Slide 7

Slide 7 text

Typed Object Model $('#element').styleMap .set("height", new CSSCalcLength({ vh: 50, px: -20, }));

Slide 8

Slide 8 text

Typed Object Model const h = new CSSSimpleLength(50, 'vh') .subtract(new CSSSimpleLength(20, ‘px')); $('#element').styleMap.set('height', h);

Slide 9

Slide 9 text

Typed Object Model const h = new CSSSimpleLength(50, 'vh') .subtract(new CSSSimpleLength(20, ‘px')); $('#element').styleMap.set('height', h); // h == calc(50vh - 20px);

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Houdini

Slide 12

Slide 12 text

Houdini X AnimationWorklet

Slide 13

Slide 13 text

Animation Worklet

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

bit.ly/best-effort-scroll position: static;

Slide 17

Slide 17 text

bit.ly/best-effort-scroll position: static; position: fixed; + JS transform

Slide 18

Slide 18 text

Animation Worklet :root { animator-root: parallax; } .bg { animator: parallax; }
Experimental

Slide 19

Slide 19 text

Animation Worklet registerAnimator('parallax', class ParallaxAnimator { static inputProperties = ['transform', '--parallax-rate']; static outputProperties = ['transform']; static rootInputScroll = true; animate(root, children) { const scrollTop = root.scrollOffsets.top; children.forEach(background => parallaxMath(elem, background.styleMap.get('--parallax-rate'))); } }); Experimental

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Houdini

Slide 22

Slide 22 text

Paint Worklet

Slide 23

Slide 23 text

Paint Worklet
#myElement { --image: url('#someUrlWhichIsLoading'); background-image: paint(image-with-placeholder); } Experimental

Slide 24

Slide 24 text

Paint Worklet document.registerProperty({ name: '--image', syntax: '<image>' }); window.paintWorklet.import('paintworklet.js'); Experimental

Slide 25

Slide 25 text

Paint Worklet registerPaint('image-with-placeholder', class { static get inputProperties() { return ['--image']; } paint(ctx, geom, properties) { // ... } }); Experimental

Slide 26

Slide 26 text

Paint Worklet paint(ctx, geom, properties) { const img = properties.get('--image'); switch (img.state) { case 'ready': ctx.drawImage(img, 0, 0, geom.width, geom.height); break; case 'pending': drawMountains(ctx); break; case 'invalid': default: drawSadFace(ctx); } } Experimental

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

bit.ly/houdini-updates

Slide 29

Slide 29 text

No content