Skip to content

Commit

Permalink
change random to animationRandom
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Aug 1, 2017
1 parent ddf04d5 commit 49ca9d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ IE 9-11, Chrome, Firefox, other modern and mobile browsers.
```javascript
// data's format
// [{ coordinates : [[x, y], [x, y]], symbol : {..} }, { coordinates : [[x, y], [x, y]], symbol : {..} } ..]
// symbol only supports lineWidth and lineColor
new maptalks.ODLineLayer(id, data, options)
```

Expand All @@ -56,6 +57,7 @@ new maptalks.ODLineLayer(id, data, options)
* curveness **Number** curveness of the od-line, from 0(straight) to 1 (0.2 by default)
* trail **Number** trail length of the particle when animating (20 by default)
* globalCompositeOperation **String** [globalCompositeOperation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation) of the canvas when drawing particles
* symbol **Object** default symbol of OD-line, only supports lineWidth and lineColor ({ lineWidth : 2, lineColor : #000 } by default)
* Other options defined in [maptalks.ParticleLayer](https://maptalks.github.io/docs/api/ParticleLayer.html)

### `getData()`
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const options = {
'animation' : true,
'animationOnce' : false,
'animatinDuration' : 6000,
'random' : false,
'animationRandom' : false,
'curveness' : 0.2,
'trail' : 20,
'globalCompositeOperation' : 'lighter'
Expand Down Expand Up @@ -71,7 +71,7 @@ export class ODLineLayer extends maptalks.ParticleLayer {
let points, x, y, style;
let p0, p1, cp;
for (let i = 0, l = this._dataToDraw.length; i < l; i++) {
if (this.options['random']) {
if (this.options['animationRandom']) {
r = ((t - this._animStartTime - this._dataToDraw[i]['time']) % duration) / duration;
if (r < 0) {
r = 0;
Expand Down

0 comments on commit 49ca9d6

Please sign in to comment.