关于
B-Design 是阿里云推出的一套面向企业应用领域的设计系统。在企业级软件服务逐渐走向云端化的趋势下,为阿里内部及合作伙伴的 SaaS 系统上云提供标准化的设计规范和指导。
B-Design 色板工具 Palette Tool
import { PaletteTool } from '@b-design/color';
const primaryColor = '#1B58F4';
const colors = PaletteTool.generate(primaryColor);
console.log(`Color Palette of ${primaryColor} from @primary100 to @primary10: `, colors);
B-Design 呼吸色工具 Breathing Color Tool
index.html
<div id="container-gl"></div>
index.js
import { BreathingColor } from '@b-design/color';
const config = {
debug: true,
dpr: window.devicePixelRatio,
frame: 1,
segment: 200,
background: 'ff6220',
palette: ['f2c04a', '6c5ed4', 'ffc5dd', '3e19e8', 'ff792f'],
offsets: [
2, 2,
2, 1.17,
0.65, 0.7,
-0.54, 0.9,
2, -0.9
],
twist: [
4, 0,
0.37, 5.7,
0.6, 0.15,
1.5, 1,
0.13, 0.05
]
};
const bdColor = new BreathingColor({
config: config,
container: document.getElementById('container-gl'),
initWidth: window.innerWidth,
initHeight: window.innerHeight
});
bdColor.init();
渲染
let rafID;
const animate = () => {
bdColor.update()
rafID = requestAnimationFrame(animate);
}
animate();
bdColor.pause();
bdColor.resume();
性能平衡
dpr: window.devicePixelRatio,
frame: 1,
segment: 200,
销毁
cancelAnimationFrame(rafID)
bdColor.destroy();
设置画布尺寸和监听鼠标事件
window.onresize = () => { bdColor.setSize(window.innerWidth || 1024, window.innerHeight || 480) };
window.onmousemove = (e) => { bdColor.setMousemove(e) };
更新预设
const config2 = {...};
bdColor.updateConfig( config2 );
查看预设
const config = bdColor.getConfig();
dev构建预览
npm start
to start development.
npm build
to build library.
cd examples && npm install && npm start
运行example示例.