CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
186 stars 68 forks source link

[feature-request] support expressions for opacity/color properties #447

Open farfromrefug opened 3 years ago

farfromrefug commented 3 years ago

The idea came from how mapbox handles hillshade layers properties. In mapbox you can define an expression for any property. I think it would be amazing to be able to use something like linear([view::zoom], (4, 10), (8, 20)) in a number property like opacity for layers and such. I am not sure if it should be a new method or if we could use the same exisisting method: setOpacity or setOpacityExpression. I am a bit worried about the latter as in the end it would increase the lib size

I think it would be fairly easy to implement for hillshade layer. If you are ok with the idea i could have a go at it. Once the concept seems good we could extend it to all vector elements

mtehver commented 3 years ago

Not sure this is the best way to do it. I am currently thinking about adding CartoCSS support for raster tiles. Thus it would be possible to mix vector tile layers and raster layers in a more unified way. Opacity functions, comp-op support would come automatically with this.

farfromrefug commented 3 years ago

@mtehver that sounds intersting ;). What i was thinking about recently was to be able to usr expression for all properties in vector elements. Working in many apps with Carto we feel more and more "constrained" by classical vector elements compared to vector tiles. And expressions are what makes the biggest difference. If we could have some kind of carto css theming for those the possibilities would be endless (navigation arrows, borders, text along lines ...). This is why i am thinking of migration my local vector layers to geojson layers( with possible PRs on the way ;))