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

Use box-shadow instead of drop-shadow to improve rendering performance in Safari. #94

Merged
merged 1 commit into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/organisms/Feature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ export default defineComponent({
top: 50px;
left: 0;
width: 160px;
filter: $shadow-screen-base;
@include box-shadow-screen-base;
}
#timetable-2 {
right: 0;
top: 115px;
width: 160px;
filter: $shadow-screen-base;
@include box-shadow-screen-base;
}
#add-1 {
top: -10px;
Expand Down Expand Up @@ -294,7 +294,7 @@ export default defineComponent({
right: 50%;
transform: translateX(50%);
width: 190px;
filter: $shadow-screen-base;
@include box-shadow-screen-base;
}

// tabletレイアウトでの画像配置
Expand Down Expand Up @@ -383,14 +383,14 @@ export default defineComponent({
display: block;
position: relative;
width: 252px;
filter: $shadow-screen-base;
@include box-shadow-screen-base;
}
#detail-2 {
display: block;
bottom: 0px;
left: 0;
width: 252px;
filter: $shadow-screen-base;
@include box-shadow-screen-base;
}
#detail-3 {
bottom: 0px;
Expand Down
12 changes: 12 additions & 0 deletions src/scss/_mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,15 @@
@content;
}
}

// Shadow
// filter の drop-shadow は Safari でのパフォーマンスが著しく低下するため box-shadow で代用
@mixin box-shadow-screen-base {
box-shadow: -20.49px -20.49px 50.95px rgba(175, 190, 198, 0.1),
48.888px 48.888px 83.808px rgba(194, 203, 207, 0.25);
}

@mixin box-shadow-screen-primary {
Copy link
Member

Choose a reason for hiding this comment

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

不要?

Copy link
Member Author

@HosokawaR HosokawaR Apr 1, 2023

Choose a reason for hiding this comment

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

今回は使われていないものの、もともと $box-shadow-screen-primary が定義されていたので、それに対応する @mixin を一応残しました

box-shadow: -14.28px -14.28px 42.84px rgba(67, 179, 186, 0.25),
64.26px 64.26px 85.68px rgba(67, 179, 186, 0.3);
}
9 changes: 0 additions & 9 deletions src/scss/_variable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ $yellow-orange-light: #fdd17b;
/* Effect styles */
$shadow-base: 0.2rem 0.4rem 1rem #a5bac74d, -0.1rem -0.1rem 0.2rem #ffffffb3,
inset -0.6rem -0.8rem 1.2rem #ffffff73, inset 0.2rem 0.3rem 0.4rem #cbd5df66;
// ↓filterプロパティに使う
$shadow-screen-base: drop-shadow(
-20.49px -20.49px 50.95px rgba(175, 190, 198, 0.1)
)
drop-shadow(48.888px 48.888px 83.808px rgba(194, 203, 207, 0.25));
$shadow-screen-primary: drop-shadow(
-14.28px -14.28px 42.84px rgba(67, 179, 186, 0.25)
)
drop-shadow(64.26px 64.26px 85.68px rgba(67, 179, 186, 0.3));

// font-size(アイコンフォントには使わなくて良い)
$font-minimum: 1rem;
Expand Down