d3.js - 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 - APPEARANCE (value => value) - 回调以获取输入顶点正在转换的值。
enter 应该返回要转换的值。对于当前顶点。
它接收两个参数:
toValue (TypedArray) - 当前顶点要转换到的新值
fromChunk (Array | TypedArray) - 对于当前顶点所属的块,要转换的现有值。“块”是一组顶点,可帮助回调确定此转换的上下文。对于大多数层,所有对象都在一个块中。对于 PathLayer 和 PolygonLayer,每个路径/多边形都是一个块。
推荐阅读
- oracle - Oracle SQL Developer 12505 网络更改后的错误
- python - 词云 MatplotLib
- python - 更高效的脚本
- sql - 跨数据库会话保持多用户状态
- sql - 最多一个查询 SQL
- c# - 成功消息后如何重定向登录页面
- byte-buddy - 有什么办法可以让byte buddy生成的这个类文件包含LocalVariableTable?
- loopbackjs - Loopback 4:如何从 loopback 4 访问名称中带有下划线的表?
- python - 如何使用列表推导将函数列表应用于参数列表
- sapui5 - SAP UI5项目中.che文件夹有什么用?