雪碧圖制作-mapbox本地化
1. 雪碧圖制作
1.1. 安裝
安裝前最好先進行矢量地圖tippecanoe擴展的安裝
1.1.1. nodejs安裝
sudo apt-get install nodejs
sudo apt-get install npm
1.1.2. spritezero-cli安裝
#下載
wget https://github.com/mapbox/spritezero-cli/archive/v2.1.0.tar.gz
#解壓
tar -xzf v2.1.0.tar.gz
#一定要使用全局代理運行
#一定要使用全局代理運行
#一定要使用全局代理運行
cd spritezero-cli-2.1.0/
apt-get install nodejs-legacy
npm install
npm install -g @mapbox/spritezero-cli
1.2. 使用
spritezero [output filename] [input directory]
--retina shorthand for --ratio=2
--ratio=[n] pixel ratio
--unique map identical images to multiple names
將整個目錄的SVG文件轉(zhuǎn)為一張PNG雪碧圖和一份JSON樣式表
- example
//一級樣式
spritezero ttt input/
//retina樣式
spritezero --retina ttt@2x input/
將整個input目錄中的所有svg文件轉(zhuǎn)換為ttt.png的雪碧圖和ttt.json的樣式表