DevDino 🦖

我曾七次鄙视自己的灵魂

children as a render function

const MovingComponent = ({ children }) => {
...
return (
<div ...// callbacks same as before
>
// children as render function with some data
// data doesn't depend on the changed state!
{children({ data: 'something' })}
</div>
);
};

const SomeOutsideComponent = () => {
return (
<MovingComponent>
// ChildComponent re-renders when state in MovingComponent changes!
// even if it doesn't use the data that is passed from it
{() => <ChildComponent />}
</MovingComponent>
)
}
阅读全文 »

加载和执行

每个<script>标签初始化下载都会阻塞页面渲染,所以减少页面的<script>标签数量可以起到优化作用,内嵌脚本外链脚本通用,另外HTTP会带来的额外的性能消耗,下载一个100KB的文件比下载4个25KB的文件更快,所以可以通过进行脚本的合并去1、减少<script>标签数量 2、减少HTTP请求带来的消耗(针对外链脚本)。

阅读全文 »

imagediffuse/base colos/albedo颜色贴图: 漫反射可以简单理解成物体表面固有的颜色

reflection/specular反射贴图:白色全反射黑色不反射(排除金银铜等金属)

阅读全文 »

齐次坐标

齐次坐标可以用来区分 (X,Y) 到底是个向量还是个坐标,它不是一个新的坐标系,不是说把二维的变成三维的,它是一种记法。

阅读全文 »