Skip to content

Commit

Permalink
update: add missing properties before update
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMonad authored and harry75369 committed Jul 2, 2024
1 parent af7b42c commit fabd9ed
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/features/graphic/image_filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Image Filters
hide_table_of_contents: true
---

import { JSONPath } from "jsonpath-plus"

<DarumaPlayer
src="/feature/image_filters/image_filters__exposure.daruma"
controlsConfig={[
Expand Down Expand Up @@ -92,8 +94,28 @@ hide_table_of_contents: true
min: -1,
max: 1,
step: 0.01,
onBeforeChange: (value, code) => {
const parsedCode = JSON.parse(code)

JSONPath({
json: parsedCode,
path: "$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters",
resultType: "all",
}).forEach(({ parent, parentProperty }) => {
parent["imageFilters"] = {
...parent["imageFilters"],
hue: value,
}
})

return {
transformedValue: value,
updatedCode: JSON.stringify(parsedCode),
}
},
},
]}

]}
/>

<br />
Expand Down

0 comments on commit fabd9ed

Please sign in to comment.