deck.gl转换和过滤



有人能解释一下与d3js相比,Deck.gl的数据更新和转换是如何工作的吗?例如,在此代码中:

var updateLayers = function(dataset) {
var scatterplot = new deck.ScatterplotLayer({
/* unique id of this layer */
id: 'checkins',
/* data: an array of objects */
data: dataset,
/* data accessors */
getPosition: d => d.geometry.coordinates, // returns longitude, latitude, [altitude]
getRadius: d => circleSize(d.properties.reviews), // returns radius in meters
getColor: d => [255, 0, 0],
outline: true, // returns R, G, B, [A] in 0-255 range
transitions: {
getRadius: {
duration: 1000,
easing: d3.easeCubicInOut,
enter: value => [value[0], value[1], value[2], 1] // fade in
}
}
})
// Add the layer to deckgl:
deckgl.setProps({ layers: [scatterplot] });
}

我不清楚enter: value => [value[0], value[1], value[2], 1]在做什么。有人能解释一下吗?我通常认为(根据d3js(这个enter:在转换中设置断点,但我不清楚value指的是什么?

https://github.com/uber/deck.gl/blob/master/docs/api-reference/layer.md

enter-Function-APPERANCE(value=>value(-回调以获取输入顶点转换的值。

enter应返回要转换的值。用于当前顶点。

它接收两个参数:

toValue(TypedArray(-当前顶点要转换到的新值

fromChunk(Array|TypedArray(-对于当前顶点所属的块,要从其转换的现有值;块";是一组顶点,帮助回调确定此转换的上下文。对于大多数层,所有对象都在一个块中。对于PathLayer和PolygonLayer,每个路径/多边形都是一个块。

最新更新