lonekorean / hello-houdini Goto Github PK
View Code? Open in Web Editor NEWSome demos using Houdini's CSS Paint API.
License: MIT License
Some demos using Houdini's CSS Paint API.
License: MIT License
hi, I try the last demo Animated Polka Dot Fade, and I notice that worklet.js is evaluated two times.
I just add some console in the demo code:
CSS.registerProperty({
name: '--dot-color',
syntax: '<color>',
initialValue: '#fff'
});
console.log('hello 1');
CSS.paintWorklet.addModule('worklet.js');
console.log('hello 2');
worklet.js is:
console.log('worklet.js');
var num = 0;
class PolkaDotFadePainter {
static get inputProperties() {
return ['--dot-spacing', '--dot-fade-offset', '--dot-color'];
}
paint(ctx, size, props) {
num ++;
console.log(123, num);
let spacing = props.get('--dot-spacing').value;
let fadeOffset = props.get('--dot-fade-offset').value;
let color = props.get('--dot-color').toString();
ctx.fillStyle = color;
for (let y = 0; y < size.height + spacing; y += spacing) {
....//not change
}
}
}
registerPaint('polka-dot-fade', PolkaDotFadePainter);
The output is.
hello 1
hello 2
worklet.js
worklet.js
123 1
123 1
123 2
123 3
123 4
123 2
123 3
123 5
Obviously paint callback is bind two times.
And in Performance, evaluate module appears two times.
My chrome is 65.0.3325.181 and I use localhost(http) to test it. Then I add console to the same demo in codepen, and console is executed once.
In Performance, evaluate module also appears two times, but it seem only executes once.
I think the difference result is because of https, but I don't have a real https environment, so it's just a guess. Have you face the same problem? :)
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.