realfish / laerhsif-essay Goto Github PK
View Code? Open in Web Editor NEWA collection of essays
Home Page: https://poisson.laerhsif.com
A collection of essays
Home Page: https://poisson.laerhsif.com
在代码中频繁地使用getImageData方法来读取上下文的像素数据,设置willReadFrequently
属性为true
可以提高性能。这是因为当你告诉浏览器你会频繁地读取像素数据时,浏览器可以采取一些优化措施。
在 a 函数中将 canvas 元素添加到了 DOM 中,然后在 c 函数中将其移除。这些操作可能会导致强制回流,因为它们修改了 DOM 的结构。你可以尝试将这些操作放在一个 requestAnimationFrame
或 setTimeout
调用中,以减少回流次数。
function a(e, t) {
var n = $.create("canvas"),
r;
requestAnimationFrame(function() {
(n.width = "50"),
(n.height = "20"),
(n.style.display = "none"),
P.appendChild(n),
((r = n.getContext("2d", { willReadFrequently: true })).textBaseline =
"top"),
(r.font = "15px " + t + ", sans-serif"),
(r.fillStyle = "black"),
(r.strokeStyle = "black"),
r.fillText(e, 0, 0);
});
return {
node: n,
context: r,
remove: function () {
requestAnimationFrame(function() {
$.remove(n, P);
});
},
};
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.