Skip to content

Commit

Permalink
feat(website): add mix-blend-mode option
Browse files Browse the repository at this point in the history
  • Loading branch information
crashmax-dev committed Jul 27, 2023
1 parent c4ef414 commit ade99b9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export const paneOptions = {
stringOptions: JSON.stringify(wallpaperOptions, null, 2),
copyOptions: cloneDeep(wallpaperOptions),
currentColors: arrayColorToObject(wallpaperOptions.colors),
patternSize: PATTERN_SIZE
patternSize: PATTERN_SIZE,
mixBlendMode: 'overlay'
}
21 changes: 21 additions & 0 deletions website/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import 'twallpaper/css'
const wallpaper = new TWallpaper(paneOptions.container, wallpaperOptions)
wallpaper.init()

const wallpaperPatternElement =
document.querySelector<HTMLElement>('.tw-pattern')!
wallpaperPatternElement.style.mixBlendMode = paneOptions.mixBlendMode

const tweakpane = new Pane({
document,
expanded: true,
Expand Down Expand Up @@ -163,6 +167,7 @@ patternsFolder
.on('change', ({ value }) => {
patternBlur.disabled = value!
patternBackground.disabled = !value!
patternMixBlendMode.disabled = value!
wallpaper.updatePattern(wallpaperOptions.pattern!)
})

Expand Down Expand Up @@ -208,6 +213,22 @@ const patternBackground = patternsFolder
wallpaper.updatePattern(wallpaperOptions.pattern!)
})

const patternMixBlendMode = patternsFolder.addBlade({
view: 'list',
value: paneOptions.mixBlendMode,
label: 'mix-blend-mode',
options: [
{ text: 'normal', value: 'normal' },
{ text: 'overlay', value: 'overlay' },
{ text: 'hard-light', value: 'hard-light' },
{ text: 'soft-light', value: 'soft-light' }
]
}) as ListApi<string>

patternMixBlendMode.on('change', (event) => {
wallpaperPatternElement.style.mixBlendMode = event.value
})

const patternsList = patternsFolder.addBlade({
view: 'list',
value: PATTERNS[0].path,
Expand Down

0 comments on commit ade99b9

Please sign in to comment.