Expressions / adaptation and cleanup after stretch operator removal

The examples have been fixed as well.
This commit is contained in:
Olivier Guyot
2019-10-25 13:21:32 +02:00
parent 719495587c
commit e843b2cfc0
6 changed files with 49 additions and 46 deletions

View File

@@ -21,7 +21,13 @@ const animRatio =
['mod',
['+',
['time'],
['stretch', ['get', 'year'], 1850, 2020, 0, period]
[
'interpolate',
['linear'],
['get', 'year'],
1850, 0,
2015, period
]
],
period
],
@@ -39,12 +45,14 @@ const style = {
symbol: {
symbolType: 'circle',
size: ['*',
['stretch', ['get', 'mass'], 0, 200000, 8, 26],
['-', 1.5, ['*', animRatio, 0.5]]
['interpolate', ['linear'], ['get', 'mass'], 0, 8, 200000, 26],
['-', 1.75, ['*', animRatio, 0.75]]
],
color: ['interpolate',
['linear'],
animRatio,
newColor, oldColor
0, newColor,
1, oldColor
],
opacity: ['-', 1.0, ['*', animRatio, 0.75]]
}

View File

@@ -26,9 +26,10 @@ const style = {
size: size,
color: [
'interpolate',
['stretch', ['get', 'year'], 1950, 2013, 0, 1],
oldColor,
newColor
['linear'],
['get', 'year'],
1950, oldColor,
2013, newColor
],
rotateWithView: false,
offset: [

View File

@@ -28,9 +28,10 @@ const predefinedStyles = {
size: 18,
color: [
'interpolate',
['stretch', ['get', 'population'], 20000, 300000, 0, 1],
'#5aca5b',
'#ff6a19'
['linear'],
['get', 'population'],
20000, '#5aca5b',
300000, '#ff6a19'
],
rotateWithView: true
}
@@ -38,11 +39,23 @@ const predefinedStyles = {
'circles': {
symbol: {
symbolType: 'circle',
size: ['stretch', ['get', 'population'], 40000, 2000000, 8, 28],
size: [
'interpolate',
['linear'],
['get', 'population'],
40000, 8,
2000000, 28
],
color: '#006688',
rotateWithView: false,
offset: [0, 0],
opacity: ['stretch', ['get', 'population'], 40000, 2000000, 0.6, 0.92]
opacity: [
'interpolate',
['linear'],
['get', 'population'],
40000, 0.6,
2000000, 0.92
]
}
}
};