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

[Collage] Add ambient effect on image block & general ambient tweaks #2547

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ludoboludo
Copy link
Contributor

@ludoboludo ludoboludo commented Apr 19, 2023

PR Summary:

Add ambient movement to the image and video block in the Collage section

Fixes a couple things in 3 other sections for the ambient movement approach

Why are these changes introduced?

Fixes #2442

What approach did you take?

Reused a similar approach that has been taken in other sections.
I've used a size_multiplier variable here to show the logic we're using to decide on the image sizes + sizes attribute.

Other considerations

Visual impact on existing themes

Adds a new animation option for imageand video block

Testing steps/scenarios

  • Go to the collage section and add an image and video block
  • Make sure the image size is the right one
  • Make sure that the movement applied on the image never uses too small of an image, revealing some whitespace.
  • Test the different layout available in the section (1 block, 2 blocks, three blocks, etc)

Demo links

Checklist

Copy link
Contributor

@kmeleta kmeleta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving some thoughts on the general approach.

sections/collage.liquid Outdated Show resolved Hide resolved
sections/collage.liquid Outdated Show resolved Hide resolved

if block.settings.image_behavior == 'ambient'
assign size_multiplier = 1.2
assign max_width = max_width | times: size_multiplier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could just default to the max width times 1.2 🤔 Cause it's only used as a fallback in case the srcset approach isn't supported and as a reference I believe for the images widths. So it shouldn't be smaller than the higher value we give the srcset.

(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 1.6667 }}px,
(min-width: 750px) calc((100vw - 130px) / 1.667), calc((100vw - 50px) / 1.667)
(min-width: {{ settings.page_width }}px) {{ settings.page_width | times: 1.2 | minus: 100 }}px,
(min-width: 750px) calc((120vw - 130px) / 2), calc((120vw - 50px) / 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a reference to this comment from the original PR that added it: #2385 (comment)

@@ -133,20 +133,18 @@
assign height = block.settings.image.width | divided_by: block.settings.image.aspect_ratio | round
if section.settings.image_behavior == 'ambient'
assign sizes = '120vw'
assign widths = '450, 660, 900, 1320, 1800, 2136, 2400, 3600, 7680'
assign widths = '450, 660, 900, 1320, 1800, 2136, 2400, 3600, 4608'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar thing here. Let me know if the 7680 was meant for a specific use case.

@ludoboludo ludoboludo requested a review from kjellr April 20, 2023 19:20
@ludoboludo ludoboludo changed the title [Collage] Add ambient effect on image block [Collage] Add ambient effect on image block & general ambient tweaks Apr 20, 2023
@ludoboludo ludoboludo requested a review from kmeleta April 24, 2023 14:00
(min-width: {{ settings.page_width }}px) calc(({{ settings.page_width }}px - 100px) * 1 / 3 - {{ grid_space_desktop }}),
(min-width: 750px) calc((100vw - 100px) * 1 / 3 - {{ grid_space_desktop }}),
{% if section.settings.mobile_layout == 'collage' %}calc((100vw - 30px) / 2 - {{ grid_space_mobile }}){% else %}calc(100vw - 30px){% endif %}
(min-width: {{ settings.page_width }}px) calc(({{ settings.page_width | times: size_multiplier }}px - 100px) * 1 / 3 - {{ grid_space_desktop }}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting some wonky sizes loading with these changes on collage. Haven't seen the issue in the other sections yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd, I think it's specific to the theme editor 🤔 I can't replicate on the live version. Or at least on the live version of the theme it seems to be fine in terms of image size it's downloading to use there 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I might see a discrepancy there for some reason, but even still I'm seeing in the realm of 3-4X the needed size for some cases outside the editor. Though I apologize because these might be pre-existing and not necessary to deal with in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tho if you look at the network tab in the inspect tool, it's loading the expected image size right ?

We're basing our sizes attribute values on what we already had by multiplied by 1.2. So the images we're getting should be a bit bigger than their containers.

There is also a PR from folks in theme support to fix an issue with the image logic in that section: #2277

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I'm definitely seeing way too large of an image asset being loaded in a lot of cases, with and without the animation. The animation logic just adds to it. But again, I think my problem here is more with the existing sizes logic more so than your changes.

@ludoboludo ludoboludo requested a review from kmeleta April 24, 2023 19:02
Copy link
Contributor

@kmeleta kmeleta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice any issues with the motion itself in collage. Generally happy with where we landed on the approach in the logic. Just left a couple small things to consider.

sections/collage.liquid Outdated Show resolved Hide resolved
sections/collage.liquid Show resolved Hide resolved
@kmeleta
Copy link
Contributor

kmeleta commented Apr 25, 2023

Changes look good to me. Thanks Ludo.

@kjellr
Copy link
Contributor

kjellr commented Apr 26, 2023

Just raising a discussion point here from slack:

We need to make a UX decision around whether or not this setting should be available on a section- or block-level for collage. In all other occurrences, this is a section-level setting, even when there are interior blocks (like Slideshow).

cc @melissaperreault

@ludoboludo
Copy link
Contributor Author

⚠️ This is going to be on hold until we're done with our next release.

@kjellr
Copy link
Contributor

kjellr commented Jun 29, 2023

I'm removing myself from this for now to stop GitHub from reminding me everyday about it. 😅 But when we pick it back up, feel free to add me back in!

@kjellr kjellr removed their request for review June 29, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Collage] Add ambient movement to background
3 participants