diff --git a/CHANGELOG.md b/CHANGELOG.md index 00e5c7cbc0..f45a323fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,14 @@ # ChangeLog #### 3.3 - Graph API - - delete removeEvent function, use off; + - refactor: delete removeEvent function, use off; +- refactor: parameters of Shape animate changed, shape.animate(toAttrs, animateCfg) or shape.animate(onFrame, animateCfg); +- feat: descriptionCfg for modelRect to define the style of description by user; +- feat: update a node from without some shapes to with them, such as linkPoints, label, logo icon and state icon for modelRect; +- feat: the callback paramter of event nodeselectchange is changed to { target, selectedItems, ... }; +- feat: support stateStyles in node and edge data; +- feat: calculate pixelRatio by G automatically, user do not need to assign it to graph instance; +- chore: G 4.0 #### 3.1.5 * feat: supports g6 types file diff --git a/demos/2203d0b476906b134775969c2fdfb004.png b/demos/2203d0b476906b134775969c2fdfb004.png index 1c00595086..12e1924ebc 100644 Binary files a/demos/2203d0b476906b134775969c2fdfb004.png and b/demos/2203d0b476906b134775969c2fdfb004.png differ diff --git a/demos/animate-edge-loop.html b/demos/animate-edge-loop.html index 0211e20743..ec0a7d3111 100644 --- a/demos/animate-edge-loop.html +++ b/demos/animate-edge-loop.html @@ -26,21 +26,21 @@ }, 'circle'); G6.registerEdge('loop-growth', { - afterDraw(cfg, group) { - const shape = group.get('children')[0]; - const length = shape.getTotalLength(); - shape.animate({ - onFrame(ratio) { - const startLen = ratio * length; - // 计算线的lineDash - const cfg = { - lineDash: [startLen, length - startLen] - }; - return cfg; - }, - repeat: true - }, 2000); - } + afterDraw(cfg, group) { + const shape = group.get('children')[0]; + const length = shape.getTotalLength(); + shape.animate(ratio => { + const startLen = ratio * length; + // 计算线的lineDash + const cfg = { + lineDash: [startLen, length - startLen] + }; + return cfg; + }, { + repeat: true, + duration: 2000 + }); + } }, 'loop'); const data = { diff --git a/demos/animate-edge.html b/demos/animate-edge.html index e086796172..961b30fcf7 100644 --- a/demos/animate-edge.html +++ b/demos/animate-edge.html @@ -79,18 +79,16 @@ r: 3 } }); - circle.animate({ - onFrame(ratio) { - const tmpPoint = shape.getPoint(ratio); - return { - x: tmpPoint.x, - y: tmpPoint.y - }; - - }, - repeat: true - }, - 3000); + circle.animate(ratio => { + const tmpPoint = shape.getPoint(ratio); + return { + x: tmpPoint.x, + y: tmpPoint.y + }; + }, { + repeat: true, + duration: 3000 + }); } }, 'cubic'); @@ -109,17 +107,16 @@ totalArray = totalArray.concat(lineDash); } let index = 0; - shape.animate({ - onFrame(ratio) { - const cfg = { - lineDash: dashArray[index].concat(totalArray) - }; - index = (index + 1) % interval; - return cfg; - }, - repeat: true - }, - 3000); + shape.animate(ratio => { + const cfg = { + lineDash: dashArray[index].concat(totalArray) + }; + index = (index + 1) % interval; + return cfg; + }, { + repeat: true, + duration: 3000 + }); } }, 'cubic'); @@ -128,18 +125,17 @@ afterDraw(cfg, group) { const shape = group.get('children')[0]; const length = shape.getTotalLength(); // G 增加了 totalLength 的接口 - shape.animate({ - onFrame(ratio) { - const startLen = ratio * length; - const cfg = { - lineDash: [startLen, length - startLen] - }; + shape.animate(ratio => { + const startLen = ratio * length; + const cfg = { + lineDash: [startLen, length - startLen] + }; - return cfg; - }, - repeat: true - }, - 2000); + return cfg; + }, { + repeat: true, + duration: 2000 + }); } }, 'cubic'); diff --git a/demos/animate-hover.html b/demos/animate-hover.html index e5b01e9836..7525740a9e 100644 --- a/demos/animate-hover.html +++ b/demos/animate-hover.html @@ -114,17 +114,16 @@ totalArray = totalArray.concat(lineDash); } let index = 0; - shape.animate({ - onFrame(ratio) { - const cfg = { - lineDash: dashArray[index].concat(totalArray) - }; - index = (index + 1) % interval; - return cfg; - }, - repeat: true - }, - 3000); + shape.animate(ratio => { + const cfg = { + lineDash: dashArray[index].concat(totalArray) + }; + index = (index + 1) % interval; + return cfg; + }, { + repeat: true, + duration: 3000 + }); } else { shape.stopAnimate(); shape.attr('lineDash', null); diff --git a/demos/animate-node-hover.html b/demos/animate-node-hover.html index 49a5c48838..8c42a976c4 100644 --- a/demos/animate-node-hover.html +++ b/demos/animate-node-hover.html @@ -18,16 +18,16 @@ const cfg = item.get('model'); if (name === 'running') { if (value) { - shape.animate({ + shape.animate(ratio => { + const diff = ratio <= 0.5 ? ratio * 10 : (1 - ratio) * 10; + return { + r: cfg.size / 2 + diff + }; + }, { repeat: true, - onFrame: function onFrame(ratio) { - const diff = ratio <= 0.5 ? ratio * 10 : (1 - ratio) * 10; - return { - r: cfg.size / 2 + diff - }; - } - }, - 1000, 'easeCubic'); + duration: 1000, + easing: 'easeCubic' + }); } else { shape.stopAnimate(); shape.attr('lineDash', null); diff --git a/demos/assets/data/background-small.png b/demos/assets/data/background-small.png index 43cfb1bfa6..8a47654d0a 100644 Binary files a/demos/assets/data/background-small.png and b/demos/assets/data/background-small.png differ diff --git a/demos/assets/data/flare.json b/demos/assets/data/flare.json index 6fa54865b2..8c21d9831b 100644 --- a/demos/assets/data/flare.json +++ b/demos/assets/data/flare.json @@ -1 +1 @@ -{"name":"flare","children":[{"name":"analytics","children":[{"name":"cluster","children":[{"name":"AgglomerativeCluster","value":3938},{"name":"CommunityStructure","value":3812},{"name":"HierarchicalCluster","value":6714},{"name":"MergeEdge","value":743}]},{"name":"graph","children":[{"name":"BetweennessCentrality","value":3534},{"name":"LinkDistance","value":5731},{"name":"MaxFlowMinCut","value":7840},{"name":"ShortestPaths","value":5914},{"name":"SpanningTree","value":3416}]},{"name":"optimization","children":[{"name":"AspectRatioBanker","value":7074}]}]},{"name":"animate","children":[{"name":"Easing","value":17010},{"name":"FunctionSequence","value":5842},{"name":"interpolate","children":[{"name":"ArrayInterpolator","value":1983},{"name":"ColorInterpolator","value":2047},{"name":"DateInterpolator","value":1375},{"name":"Interpolator","value":8746},{"name":"MatrixInterpolator","value":2202},{"name":"NumberInterpolator","value":1382},{"name":"ObjectInterpolator","value":1629},{"name":"PointInterpolator","value":1675},{"name":"RectangleInterpolator","value":2042}]},{"name":"ISchedulable","value":1041},{"name":"Parallel","value":5176},{"name":"Pause","value":449},{"name":"Scheduler","value":5593},{"name":"Sequence","value":5534},{"name":"Transition","value":9201},{"name":"Transitioner","value":19975},{"name":"TransitionEvent","value":1116},{"name":"Tween","value":6006}]},{"name":"data","children":[{"name":"converters","children":[{"name":"Converters","value":721},{"name":"DelimitedTextConverter","value":4294},{"name":"GraphMLConverter","value":9800},{"name":"IDataConverter","value":1314},{"name":"JSONConverter","value":2220}]},{"name":"DataField","value":1759},{"name":"DataSchema","value":2165},{"name":"DataSet","value":586},{"name":"DataSource","value":3331},{"name":"DataTable","value":772},{"name":"DataUtil","value":3322}]},{"name":"display","children":[{"name":"DirtySprite","value":8833},{"name":"LineSprite","value":1732},{"name":"RectSprite","value":3623},{"name":"TextSprite","value":10066}]},{"name":"flex","children":[{"name":"FlareVis","value":4116}]},{"name":"physics","children":[{"name":"DragForce","value":1082},{"name":"GravityForce","value":1336},{"name":"IForce","value":319},{"name":"NBodyForce","value":10498},{"name":"Particle","value":2822},{"name":"Simulation","value":9983},{"name":"Spring","value":2213},{"name":"SpringForce","value":1681}]},{"name":"query","children":[{"name":"AggregateExpression","value":1616},{"name":"And","value":1027},{"name":"Arithmetic","value":3891},{"name":"Average","value":891},{"name":"BinaryExpression","value":2893},{"name":"Comparison","value":5103},{"name":"CompositeExpression","value":3677},{"name":"Count","value":781},{"name":"DateUtil","value":4141},{"name":"Distinct","value":933},{"name":"Expression","value":5130},{"name":"ExpressionIterator","value":3617},{"name":"Fn","value":3240},{"name":"If","value":2732},{"name":"IsA","value":2039},{"name":"Literal","value":1214},{"name":"Match","value":3748},{"name":"Maximum","value":843},{"name":"methods","children":[{"name":"add","value":593},{"name":"and","value":330},{"name":"average","value":287},{"name":"count","value":277},{"name":"distinct","value":292},{"name":"div","value":595},{"name":"eq","value":594},{"name":"fn","value":460},{"name":"gt","value":603},{"name":"gte","value":625},{"name":"iff","value":748},{"name":"isa","value":461},{"name":"lt","value":597},{"name":"lte","value":619},{"name":"max","value":283},{"name":"min","value":283},{"name":"mod","value":591},{"name":"mul","value":603},{"name":"neq","value":599},{"name":"not","value":386},{"name":"or","value":323},{"name":"orderby","value":307},{"name":"range","value":772},{"name":"select","value":296},{"name":"stddev","value":363},{"name":"sub","value":600},{"name":"sum","value":280},{"name":"update","value":307},{"name":"variance","value":335},{"name":"where","value":299},{"name":"xor","value":354},{"name":"_","value":264}]},{"name":"Minimum","value":843},{"name":"Not","value":1554},{"name":"Or","value":970},{"name":"Query","value":13896},{"name":"Range","value":1594},{"name":"StringUtil","value":4130},{"name":"Sum","value":791},{"name":"Variable","value":1124},{"name":"Variance","value":1876},{"name":"Xor","value":1101}]},{"name":"scale","children":[{"name":"IScaleMap","value":2105},{"name":"LinearScale","value":1316},{"name":"LogScale","value":3151},{"name":"OrdinalScale","value":3770},{"name":"QuantileScale","value":2435},{"name":"QuantitativeScale","value":4839},{"name":"RootScale","value":1756},{"name":"Scale","value":4268},{"name":"ScaleType","value":1821},{"name":"TimeScale","value":5833}]},{"name":"util","children":[{"name":"Arrays","value":8258},{"name":"Colors","value":10001},{"name":"Dates","value":8217},{"name":"Displays","value":12555},{"name":"Filter","value":2324},{"name":"Geometry","value":10993},{"name":"heap","children":[{"name":"FibonacciHeap","value":9354},{"name":"HeapNode","value":1233}]},{"name":"IEvaluable","value":335},{"name":"IPredicate","value":383},{"name":"IValueProxy","value":874},{"name":"math","children":[{"name":"DenseMatrix","value":3165},{"name":"Matrix","value":2815},{"name":"SparseMatrix","value":3366}]},{"name":"Maths","value":17705},{"name":"Orientation","value":1486},{"name":"palette","children":[{"name":"ColorPalette","value":6367},{"name":"Palette","value":1229},{"name":"ShapePalette","value":2059},{"name":"SizePalette","value":2291}]},{"name":"Property","value":5559},{"name":"Shapes","value":19118},{"name":"Sort","value":6887},{"name":"Stats","value":6557},{"name":"Strings","value":22026}]},{"name":"vis","children":[{"name":"axis","children":[{"name":"Axes","value":1302},{"name":"Axis","value":24593},{"name":"AxisGridLine","value":652},{"name":"AxisLabel","value":636},{"name":"CartesianAxes","value":6703}]},{"name":"controls","children":[{"name":"AnchorControl","value":2138},{"name":"ClickControl","value":3824},{"name":"Control","value":1353},{"name":"ControlList","value":4665},{"name":"DragControl","value":2649},{"name":"ExpandControl","value":2832},{"name":"HoverControl","value":4896},{"name":"IControl","value":763},{"name":"PanZoomControl","value":5222},{"name":"SelectionControl","value":7862},{"name":"TooltipControl","value":8435}]},{"name":"data","children":[{"name":"Data","value":20544},{"name":"DataList","value":19788},{"name":"DataSprite","value":10349},{"name":"EdgeSprite","value":3301},{"name":"NodeSprite","value":19382},{"name":"render","children":[{"name":"ArrowType","value":698},{"name":"EdgeRenderer","value":5569},{"name":"IRenderer","value":353},{"name":"ShapeRenderer","value":2247}]},{"name":"ScaleBinding","value":11275},{"name":"Tree","value":7147},{"name":"TreeBuilder","value":9930}]},{"name":"events","children":[{"name":"DataEvent","value":2313},{"name":"SelectionEvent","value":1880},{"name":"TooltipEvent","value":1701},{"name":"VisualizationEvent","value":1117}]},{"name":"legend","children":[{"name":"Legend","value":20859},{"name":"LegendItem","value":4614},{"name":"LegendRange","value":10530}]},{"name":"operator","children":[{"name":"distortion","children":[{"name":"BifocalDistortion","value":4461},{"name":"Distortion","value":6314},{"name":"FisheyeDistortion","value":3444}]},{"name":"encoder","children":[{"name":"ColorEncoder","value":3179},{"name":"Encoder","value":4060},{"name":"PropertyEncoder","value":4138},{"name":"ShapeEncoder","value":1690},{"name":"SizeEncoder","value":1830}]},{"name":"filter","children":[{"name":"FisheyeTreeFilter","value":5219},{"name":"GraphDistanceFilter","value":3165},{"name":"VisibilityFilter","value":3509}]},{"name":"IOperator","value":1286},{"name":"label","children":[{"name":"Labeler","value":9956},{"name":"RadialLabeler","value":3899},{"name":"StackedAreaLabeler","value":3202}]},{"name":"layout","children":[{"name":"AxisLayout","value":6725},{"name":"BundledEdgeRouter","value":3727},{"name":"CircleLayout","value":9317},{"name":"CirclePackingLayout","value":12003},{"name":"DendrogramLayout","value":4853},{"name":"ForceDirectedLayout","value":8411},{"name":"IcicleTreeLayout","value":4864},{"name":"IndentedTreeLayout","value":3174},{"name":"Layout","value":7881},{"name":"NodeLinkTreeLayout","value":12870},{"name":"PieLayout","value":2728},{"name":"RadialTreeLayout","value":12348},{"name":"RandomLayout","value":870},{"name":"StackedAreaLayout","value":9121},{"name":"TreeMapLayout","value":9191}]},{"name":"Operator","value":2490},{"name":"OperatorList","value":5248},{"name":"OperatorSequence","value":4190},{"name":"OperatorSwitch","value":2581},{"name":"SortOperator","value":2023}]},{"name":"Visualization","value":16540}]}]} +{"name":"flare","children":[{"name":"analytics","children":[{"name":"cluster","children":[{"name":"AgglomerativeCluster","value":3938},{"name":"CommunityStructure","value":3812},{"name":"HierarchicalCluster","value":6714},{"name":"MergeEdge","value":743}]},{"name":"graph","children":[{"name":"BetweennessCentrality","value":3534},{"name":"LinkDistance","value":5731},{"name":"MaxFlowMinCut","value":7840},{"name":"ShortestPaths","value":5914},{"name":"SpanningTree","value":3416}]},{"name":"optimization","children":[{"name":"AspectRatioBanker","value":7074}]}]},{"name":"animate","children":[{"name":"Easing","value":17010},{"name":"FunctionSequence","value":5842},{"name":"interpolate","children":[{"name":"ArrayInterpolator","value":1983},{"name":"ColorInterpolator","value":2047},{"name":"DateInterpolator","value":1375},{"name":"Interpolator","value":8746},{"name":"MatrixInterpolator","value":2202},{"name":"NumberInterpolator","value":1382},{"name":"ObjectInterpolator","value":1629},{"name":"PointInterpolator","value":1675},{"name":"RectangleInterpolator","value":2042}]},{"name":"ISchedulable","value":1041},{"name":"Parallel","value":5176},{"name":"Pause","value":449},{"name":"Scheduler","value":5593},{"name":"Sequence","value":5534},{"name":"Transition","value":9201},{"name":"Transitioner","value":19975},{"name":"TransitionEvent","value":1116},{"name":"Tween","value":6006}]},{"name":"data","children":[{"name":"converters","children":[{"name":"Converters","value":721},{"name":"DelimitedTextConverter","value":4294},{"name":"GraphMLConverter","value":9800},{"name":"IDataConverter","value":1314},{"name":"JSONConverter","value":2220}]},{"name":"DataField","value":1759},{"name":"DataSchema","value":2165},{"name":"DataSet","value":586},{"name":"DataSource","value":3331},{"name":"DataTable","value":772},{"name":"DataUtil","value":3322}]},{"name":"display","children":[{"name":"DirtySprite","value":8833},{"name":"LineSprite","value":1732},{"name":"RectSprite","value":3623},{"name":"TextSprite","value":10066}]},{"name":"flex","children":[{"name":"FlareVis","value":4116}]},{"name":"physics","children":[{"name":"DragForce","value":1082},{"name":"GravityForce","value":1336},{"name":"IForce","value":319},{"name":"NBodyForce","value":10498},{"name":"Particle","value":2822},{"name":"Simulation","value":9983},{"name":"Spring","value":2213},{"name":"SpringForce","value":1681}]},{"name":"query","children":[{"name":"AggregateExpression","value":1616},{"name":"And","value":1027},{"name":"Arithmetic","value":3891},{"name":"Average","value":891},{"name":"BinaryExpression","value":2893},{"name":"Comparison","value":5103},{"name":"CompositeExpression","value":3677},{"name":"Count","value":781},{"name":"DateUtil","value":4141},{"name":"Distinct","value":933},{"name":"Expression","value":5130},{"name":"ExpressionIterator","value":3617},{"name":"Fn","value":3240},{"name":"If","value":2732},{"name":"IsA","value":2039},{"name":"Literal","value":1214},{"name":"Match","value":3748},{"name":"Maximum","value":843},{"name":"methods","children":[{"name":"add","value":593},{"name":"and","value":330},{"name":"average","value":287},{"name":"count","value":277},{"name":"distinct","value":292},{"name":"div","value":595},{"name":"eq","value":594},{"name":"fn","value":460},{"name":"gt","value":603},{"name":"gte","value":625},{"name":"iff","value":748},{"name":"isa","value":461},{"name":"lt","value":597},{"name":"lte","value":619},{"name":"max","value":283},{"name":"min","value":283},{"name":"mod","value":591},{"name":"mul","value":603},{"name":"neq","value":599},{"name":"not","value":386},{"name":"or","value":323},{"name":"orderby","value":307},{"name":"range","value":772},{"name":"select","value":296},{"name":"stddev","value":363},{"name":"sub","value":600},{"name":"sum","value":280},{"name":"update","value":307},{"name":"variance","value":335},{"name":"where","value":299},{"name":"xor","value":354},{"name":"_","value":264}]},{"name":"Minimum","value":843},{"name":"Not","value":1554},{"name":"Or","value":970},{"name":"Query","value":13896},{"name":"Range","value":1594},{"name":"StringUtil","value":4130},{"name":"Sum","value":791},{"name":"Variable","value":1124},{"name":"Variance","value":1876},{"name":"Xor","value":1101}]},{"name":"scale","children":[{"name":"IScaleMap","value":2105},{"name":"LinearScale","value":1316},{"name":"LogScale","value":3151},{"name":"OrdinalScale","value":3770},{"name":"QuantileScale","value":2435},{"name":"QuantitativeScale","value":4839},{"name":"RootScale","value":1756},{"name":"Scale","value":4268},{"name":"ScaleType","value":1821},{"name":"TimeScale","value":5833}]},{"name":"util","children":[{"name":"Arrays","value":8258},{"name":"Colors","value":10001},{"name":"Dates","value":8217},{"name":"Displays","value":12555},{"name":"Filter","value":2324},{"name":"Geometry","value":10993},{"name":"heap","children":[{"name":"FibonacciHeap","value":9354},{"name":"HeapNode","value":1233}]},{"name":"IEvaluable","value":335},{"name":"IPredicate","value":383},{"name":"IValueProxy","value":874},{"name":"math","children":[{"name":"DenseMatrix","value":3165},{"name":"IMatrix","value":2815},{"name":"SparseMatrix","value":3366}]},{"name":"Maths","value":17705},{"name":"Orientation","value":1486},{"name":"palette","children":[{"name":"ColorPalette","value":6367},{"name":"Palette","value":1229},{"name":"ShapePalette","value":2059},{"name":"SizePalette","value":2291}]},{"name":"Property","value":5559},{"name":"Shapes","value":19118},{"name":"Sort","value":6887},{"name":"Stats","value":6557},{"name":"Strings","value":22026}]},{"name":"vis","children":[{"name":"axis","children":[{"name":"Axes","value":1302},{"name":"Axis","value":24593},{"name":"AxisGridLine","value":652},{"name":"AxisLabel","value":636},{"name":"CartesianAxes","value":6703}]},{"name":"controls","children":[{"name":"AnchorControl","value":2138},{"name":"ClickControl","value":3824},{"name":"Control","value":1353},{"name":"ControlList","value":4665},{"name":"DragControl","value":2649},{"name":"ExpandControl","value":2832},{"name":"HoverControl","value":4896},{"name":"IControl","value":763},{"name":"PanZoomControl","value":5222},{"name":"SelectionControl","value":7862},{"name":"TooltipControl","value":8435}]},{"name":"data","children":[{"name":"Data","value":20544},{"name":"DataList","value":19788},{"name":"DataSprite","value":10349},{"name":"EdgeSprite","value":3301},{"name":"NodeSprite","value":19382},{"name":"render","children":[{"name":"ArrowType","value":698},{"name":"EdgeRenderer","value":5569},{"name":"IRenderer","value":353},{"name":"ShapeRenderer","value":2247}]},{"name":"ScaleBinding","value":11275},{"name":"Tree","value":7147},{"name":"TreeBuilder","value":9930}]},{"name":"events","children":[{"name":"DataEvent","value":2313},{"name":"SelectionEvent","value":1880},{"name":"TooltipEvent","value":1701},{"name":"VisualizationEvent","value":1117}]},{"name":"legend","children":[{"name":"Legend","value":20859},{"name":"LegendItem","value":4614},{"name":"LegendRange","value":10530}]},{"name":"operator","children":[{"name":"distortion","children":[{"name":"BifocalDistortion","value":4461},{"name":"Distortion","value":6314},{"name":"FisheyeDistortion","value":3444}]},{"name":"encoder","children":[{"name":"ColorEncoder","value":3179},{"name":"Encoder","value":4060},{"name":"PropertyEncoder","value":4138},{"name":"ShapeEncoder","value":1690},{"name":"SizeEncoder","value":1830}]},{"name":"filter","children":[{"name":"FisheyeTreeFilter","value":5219},{"name":"GraphDistanceFilter","value":3165},{"name":"VisibilityFilter","value":3509}]},{"name":"IOperator","value":1286},{"name":"label","children":[{"name":"Labeler","value":9956},{"name":"RadialLabeler","value":3899},{"name":"StackedAreaLabeler","value":3202}]},{"name":"layout","children":[{"name":"AxisLayout","value":6725},{"name":"BundledEdgeRouter","value":3727},{"name":"CircleLayout","value":9317},{"name":"CirclePackingLayout","value":12003},{"name":"DendrogramLayout","value":4853},{"name":"ForceDirectedLayout","value":8411},{"name":"IcicleTreeLayout","value":4864},{"name":"IndentedTreeLayout","value":3174},{"name":"Layout","value":7881},{"name":"NodeLinkTreeLayout","value":12870},{"name":"PieLayout","value":2728},{"name":"RadialTreeLayout","value":12348},{"name":"RandomLayout","value":870},{"name":"StackedAreaLayout","value":9121},{"name":"TreeMapLayout","value":9191}]},{"name":"Operator","value":2490},{"name":"OperatorList","value":5248},{"name":"OperatorSequence","value":4190},{"name":"OperatorSwitch","value":2581},{"name":"SortOperator","value":2023}]},{"name":"Visualization","value":16540}]}]} diff --git a/demos/assets/data/footer.png b/demos/assets/data/footer.png index a1c60d3325..e00f5f29e3 100644 Binary files a/demos/assets/data/footer.png and b/demos/assets/data/footer.png differ diff --git a/demos/case-beijing-metro-animation.html b/demos/case-beijing-metro-animation.html index 33556e622f..2c290086f5 100644 --- a/demos/case-beijing-metro-animation.html +++ b/demos/case-beijing-metro-animation.html @@ -68,22 +68,31 @@ const delayBase = Math.random() * 2000; back1.animate({ // 逐渐放大,并消失 r: r + 10, - opacity: 0.0, - repeat: true // 循环 - }, - 3000, 'easeCubic', null, delayBase) // 无延迟 + opacity: 0.0 + }, { + repeat: true, // 循环 + duration: 3000, + easing: 'easeCubic', + delay: delayBase // 无延迟 + }); back2.animate({ // 逐渐放大,并消失 r: r + 10, - opacity: 0.0, - repeat: true // 循环 - }, - 3000, 'easeCubic', null, delayBase + 1000) // 1 秒延迟 + opacity: 0.0 + }, { + repeat: true, // 循环 + duration: 3000, + easing: 'easeCubic', + delay: delayBase + 1000 // 1 秒延迟 + }); back3.animate({ // 逐渐放大,并消失 r: r + 10, - opacity: 0.0, - repeat: true // 循环 - }, - 3000, 'easeCubic', null, delayBase + 2000) // 2 秒延迟 + opacity: 0.0 + }, { + repeat: true, // 循环 + duration: 3000, + easing: 'easeCubic', + delay: delayBase + 2000 // 2 秒延迟 + }); } }, 'circle'); @@ -109,21 +118,22 @@ shadowBlur: 30, } }); - circle.animate({ - onFrame(ratio) { - ratio += i / circleCount; - if (ratio > 1) { - ratio %= 1; - } - const tmpPoint = shape.getPoint(ratio); - return { - x: tmpPoint.x, - y: tmpPoint.y - }; - }, - repeat: true - }, - 10 * length, 'easeCubic', null, delay); + circle.animate(ratio => { + ratio += i / circleCount; + if (ratio > 1) { + ratio %= 1; + } + const tmpPoint = shape.getPoint(ratio); + return { + x: tmpPoint.x, + y: tmpPoint.y + }; + }, { + repeat: true, + duration: 10 * length, + easing: 'easeCubic', + delay + }); } } }, diff --git a/demos/custom-node-bar-chart.html b/demos/custom-node-bar-chart.html index 144fc35a28..66ade8d177 100644 --- a/demos/custom-node-bar-chart.html +++ b/demos/custom-node-bar-chart.html @@ -61,15 +61,19 @@ // 加上交互动画 fan.on('mouseenter', function(evt) { fan.animate({ - re: re + 8, - repeat: false - }, 300); + re: re + 8 + }, { + repeat: false, + duration: 300 + }); }); fan.on('mouseleave', function(evt) { fan.animate({ - re:re, - repeat: false - }, 300); + re:re + }, { + repeat: false, + duration: 300 + }); }); // 设置class diff --git a/demos/custom-node-chart.html b/demos/custom-node-chart.html index 47e2170f27..f883122ad6 100644 --- a/demos/custom-node-chart.html +++ b/demos/custom-node-chart.html @@ -73,15 +73,19 @@ // 加上交互动画 fan.on('mouseenter', function(evt) { fan.animate({ - re: re + 8, - repeat: false - }, 300); + re: re + 8 + }, { + repeat: false, + duration: 300 + }); }); fan.on('mouseleave', function(evt) { fan.animate({ - re:re, - repeat: false - }, 300); + re: re + }, { + repeat: false, + duration: 300 + }); }); // 设置class @@ -193,15 +197,19 @@ // 加上交互动画 littleCircle.on('mouseenter', function(evt) { littleCircle.animate({ - r: 5, - repeat: false - }, 200); + r: 5 + }, { + repeat: false, + duration: 200 + }); }); littleCircle.on('mouseleave', function(evt) { littleCircle.animate({ - r: 2, - repeat: false - }, 200); + r: 2 + }, { + repeat: false, + duration: 200 + }); }); // 设置class littleCircle.set("className", 'littleCircle'); diff --git a/demos/custom-node-line-chart.html b/demos/custom-node-line-chart.html index 398e3f8bda..e91bfc5661 100644 --- a/demos/custom-node-line-chart.html +++ b/demos/custom-node-line-chart.html @@ -94,15 +94,19 @@ // 加上交互动画 littleCircle.on('mouseenter', function(evt) { littleCircle.animate({ - r: 5, - repeat: false - }, 200); + r: 5 + }, { + repeat: false, + duration: 200 + }); }); littleCircle.on('mouseleave', function(evt) { littleCircle.animate({ - r: 2, - repeat: false - }, 200); + r: 2 + }, { + repeat: false, + duration: 200 + }); }); // 设置class littleCircle.set("className", 'littleCircle'); diff --git a/demos/interact-dynamic-add-tree.html b/demos/interact-dynamic-add-tree.html index d54e273f02..6b50ddb604 100644 --- a/demos/interact-dynamic-add-tree.html +++ b/demos/interact-dynamic-add-tree.html @@ -14,7 +14,6 @@ container: 'mountNode', width: 500, height: 500, - pixelRatio: 2, renderer: 'svg', modes: { default: ['collapse-expand', 'drag-canvas'] diff --git a/demos/interactive-tree.html b/demos/interactive-tree.html index 26c936701c..bd99abd88b 100644 --- a/demos/interactive-tree.html +++ b/demos/interactive-tree.html @@ -126,7 +126,6 @@ container: 'mountNode', width: 500, height: 500, - pixelRatio: 2, renderer: 'svg', modes: { default: ['drag-canvas'] diff --git a/demos/internal-edge-loop.html b/demos/internal-edge-loop.html new file mode 100644 index 0000000000..d443356fb2 --- /dev/null +++ b/demos/internal-edge-loop.html @@ -0,0 +1,153 @@ + + +
+ + + +