This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canvas = new OffscreenCanvas(1000, 1000); | |
const ctx = canvas.getContext('2d' /* not sure if this is special */); | |
const layer = new CanvasVRLayer(canvas); | |
async function drawLoop() { | |
do { | |
} while (await ctx.commit()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface VRAnchor { | |
readonly attribute VRCoordinateSystem coordinateSystem; | |
}; | |
[Constructor(VRDisplay)] | |
interface VRStageAnchor : VRAnchor { | |
readonly attribute float sizeX; | |
readonly attribute float sizeY; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.painting { | |
background-image: paint(typed, 10px), url(foo2.png); | |
background-image: paint(typed, red), url(foo1.png); | |
} | |
</style> | |
<script> | |
// paint worklet | |
registerPaint('typed', class { | |
static inputArguments = ['<length>']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const source = ???; | |
const audioWorkletNode = new AudioWorkletNode('filter'); | |
source.connect(audioWorkletNode); | |
audioWorkletNode.connect(ctx.destination); | |
|----------| | |
|---| | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerAnimator('foo', class { | |
static elements = { | |
scroller: { | |
isRoot: true; | |
scrollInput: true; | |
}, | |
parallax: { | |
outputProperties: ['transform'] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// animation worklet | |
registerAnimator('parallaxAnim', class { | |
static inputs = { | |
'scroller': { | |
'scrollTop' | |
}, | |
'parallax': { | |
'style': ['transform'] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerAnimator('parallax', class { | |
static inputs = { | |
'scroller': ScrollSource; | |
}; | |
static outputs = { | |
'parallax': Style(['transform']) // This is bad. | |
} | |
animate(inputs, outputs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerAnimator('parallax', class { | |
animate(inputs, outputs) { | |
// read scroller vertical scroll offset. | |
const scrollTop = inputs.scroller.scrollTop; | |
// update parallax transform | |
let t = outputs.parallax.styleMap.get('transform').m42; | |
t = -0.2 * scrollTop; | |
outputs.parallax.styleMap.set('transform', new CSSTransformValue(... t)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerLayout('my-grid-layout', class { | |
static inputProperties = [/* etc */]; | |
constructor() { | |
this.grid = []; // Place items on a cached grid so don't have to recompute each layout call. | |
} | |
addRemoveChildren(addRemoveList) { | |
// Rebuild grid now, only occurs when child list changes. | |
for (let i = 0; i < addRemoveList.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BlockFlowLayout::layout(Box* box) | |
{ | |
// START TOP GENERATOR MACRO | |
switch (m_state) { | |
case 0: | |
goto a; | |
case 1: | |
goto b; | |
} |