Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backdrop-filter property added #1387

Merged
merged 5 commits into from
Oct 18, 2023
Merged

backdrop-filter property added #1387

merged 5 commits into from
Oct 18, 2023

Conversation

harshdoesdev
Copy link
Contributor

@harshdoesdev harshdoesdev commented Oct 17, 2023

backdrop-filter property allows us to apply various filters as the backdrop of a container (like blur, brightness, sepia, etc). It is a very cool property that fastn should support. It can be used for implementing Glassmorphism design principles. Many fastn folks were requesting this property and there is also a discussion advocating for this feature.

Example:

-- ftd.backdrop-filter bdf:
blur.px: 10
;; brightness.percent: 50
;; contrast.percent: 40
;; grayscale.percent: 40
;; invert.percent: 70
;; opacity.percent: 20
;; sepia.percent: 90
;; saturate.percent: 80


;; All of the above properties (which have been commented) are supported



-- boolean $blur-image: true



-- ftd.image: https://picsum.photos/200
id: test
width.fixed.px: 300
height.fixed.px: 300



-- ftd.row:
anchor.id: test
width.fixed.px: 300
height.fixed.px: 300
backdrop-filter if { blur-image }: $bdf


-- ftd.text: >> Blur/Unblur Image <<
$on-click$: $ftd.toggle($a = $blur-image)

Output:

When blur filter is applied
image

When blur filter is not applied
image

@amitu
Copy link
Contributor

amitu commented Oct 18, 2023

-- ftd.backdrop-filter bdf:
blur.px: 10
brightness.percent: 50

Is this supported? More than one properties can be applied?

Also

-- ftd.row:
backdrop-filter.blur.px if { blur-image }: 10

Is easier to write. This makes it easy if you want to apply only one filter. If we want to add multiple filters we should have:

-- ftd.row:
backdrop-filter.multi if { blur-image }: $bdf

This way simple case (one filter) is simple, no need to create a variable, and complex case (multiple filters) is possible.

@harshdoesdev
Copy link
Contributor Author

-- ftd.backdrop-filter bdf:
blur.px: 10
brightness.percent: 50

Is this supported? More than one properties can be applied?

Also

-- ftd.row:
backdrop-filter.blur.px if { blur-image }: 10

Is easier to write. This makes it easy if you want to apply only one filter. If we want to add multiple filters we should have:

-- ftd.row:
backdrop-filter.multi if { blur-image }: $bdf

This way simple case (one filter) is simple, no need to create a variable, and complex case (multiple filters) is possible.

Yes, more than one properties can be applied. and the one liner syntax looks really cool, will definitely implement it once I reach home.

@Heulitig
Copy link
Contributor

-- ftd.backdrop-filter bdf:
blur.px: 10
brightness.percent: 50

Is this supported? More than one properties can be applied?

Also

-- ftd.row:
backdrop-filter.blur.px if { blur-image }: 10

Is easier to write. This makes it easy if you want to apply only one filter. If we want to add multiple filters we should have:

-- ftd.row:
backdrop-filter.multi if { blur-image }: $bdf

This way simple case (one filter) is simple, no need to create a variable, and complex case (multiple filters) is possible.

I have adjusted the type of backdrop-filter to or-type to accept both single filter values as well as multi values through records

@Heulitig Heulitig added the Testing in progress Development is done, but the test checks are in progress label Oct 18, 2023
@Heulitig Heulitig merged commit d3ec7f4 into main Oct 18, 2023
1 check passed
@Heulitig Heulitig deleted the backdrop-filter branch October 18, 2023 10:01
@apneduniya
Copy link
Contributor

Finally 🔥

@Heulitig Heulitig removed the Testing in progress Development is done, but the test checks are in progress label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants