viewof t2 = {
const colorScale = d3
.scaleLinear()
.domain([0, 5])
.range(["blue", "red"])
.interpolate(d3.interpolateHcl);
return stack({
value: 5.3,
min: 0,
max: video.duration,
step: 0.1,
width: 600,
zoomRange: [0, 10],
zoomTranslateExtent: [-5, 11],
zoomScaleExtent: [width / video.duration, 5000],
tracks: [
{
constructor: thumbnails,
options: {
frameAt: t =>
frameAt(video.currentSrc, t, { crossOrigin: 'anonymous' }),
aspectRatio: video.videoWidth / video.videoHeight
}
},
{
constructor: ruler
},
{
constructor: buttons
},
...[
[{ start: -1, end: 1 }, { start: 2.5, end: 7 }],
[{ start: 0, end: 2 }],
[{ start: 1, end: 2 }],
[{ start: 3, end: 5 }]
].map(data => ({
constructor: intervals,
options: {
data,
color: d => colorScale(d.start)
}
})),
{
constructor: points,
options: {
data: [
{ value: -1 },
{ value: 2 },
{ value: 4 },
{ value: 1.9 },
{ value: 9 }
],
color: d => colorScale(d.value),
snap: true,
valueof: d => d.value
},
bindZoomRange: false
},
{
constructor: springRuler,
options: { speed: 5 },
bindZoomRange: false
}
]
});
}