This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let viewportWidth = document.documentElement.clientWidth; | |
let viewportHeight = document.documentElement.clientHeight; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canvas { | |
position: fixed; | |
z-index: -1; | |
top: 0; | |
left: 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<canvas id="bg"></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SolidColorPainter { | |
static get inputArguments() { | |
return ['<color>']; | |
} | |
paint(ctx, size, props, args) { | |
ctx.fillStyle = args[0].toString(); | |
ctx.fillRect(0, 0, size.width, size.height); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.solid { | |
background-image: paint(solid-color, #c0eb75); | |
/* other styles as needed... */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('registerProperty' in CSS) { | |
// good to go! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('CSSUnitValue' in window) { | |
// good to go! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.polka-dot { | |
--dot-spacing: 20px; | |
--dot-fade-offset: 0%; | |
--dot-color: #fc466b; | |
background: paint(polka-dot-fade); | |
/* other styles as needed... */ | |
} | |
.polka-dot:hover, .polka-dot:focus { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.polka-dot { | |
--dot-spacing: 20px; | |
--dot-fade-offset: 0%; | |
--dot-color: #40e0d0; | |
background: paint(polka-dot-fade); | |
/* other styles as needed... */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PolkaDotFadePainter { | |
static get inputProperties() { | |
return ['--dot-spacing', '--dot-fade-offset', '--dot-color']; | |
} | |
paint(ctx, size, props) { | |
let spacing = props.get('--dot-spacing').value; | |
let fadeOffset = props.get('--dot-fade-offset').value; | |
let color = props.get('--dot-color').toString(); |