Skip to content

Commit

Permalink
IMask bezier change and back button wrapper create
Browse files Browse the repository at this point in the history
  • Loading branch information
fecapark committed Jun 7, 2022
1 parent ab2735c commit 1784408
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 43 deletions.
56 changes: 24 additions & 32 deletions src/components/Cards/HeadInfoCard/BackMask.ani.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,32 @@ function iMaskTriggerAnimation(
let maskTargetSize: number;

return [
[
{
target: iMask,
styles: [
{
prop: "width",
fvalue: "%xpx",
from: () => [0],
to: () => [maskTargetSize],
},
],
duration: 0.5,
bezier: "material-normal",
onStart: () => {
maskTargetSize = Math.sqrt(
{
target: iMask,
styles: [
{
prop: "width",
fvalue: "%xpx",
from: () => [0],
to: () => [maskTargetSize],
},
{
prop: "height",
fvalue: "%xpx",
from: () => [0],
to: () => [maskTargetSize],
},
],
duration: 0.9,
bezier: [0.22, 0.68, 0, 1],
onStart: () => {
maskTargetSize =
Math.sqrt(
Math.pow(headCard.getBoundingClientRect().width * 2, 2) +
Math.pow(headCard.getBoundingClientRect().height * 2, 2)
);
},
) * 1.01;
},
{
target: iMask,
styles: [
{
prop: "height",
fvalue: "%xpx",
from: () => [0],
to: () => [maskTargetSize],
},
],
duration: 0.5,
bezier: "material-normal",
},
],
},
];
}

Expand Down Expand Up @@ -77,7 +69,7 @@ function headCardHeightNormalizeAnimation(
to: () => getShadowValue(0),
},
],
duration: 0.5,
duration: 0.4,
bezier: "material-accel",
},
];
Expand Down
21 changes: 15 additions & 6 deletions src/components/Cards/HeadInfoCard/HeadInfoCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
display: flex;
flex-direction: column;
align-items: center;
flex-wrap: wrap;

font-size: 12px;
color: black;
background-color: white;
padding: 15px;
// padding: 15px;

.i-mask {
position: absolute;
Expand All @@ -24,13 +25,21 @@
z-index: 10000;
}

i {
cursor: pointer;
font-size: 14px;
color: $secondary-text-color;
align-self: flex-start;
.back-button-wrapper {
width: 30px;
height: 30px;

display: flex;
justify-content: center;
align-items: center;
align-self: flex-start;
opacity: 0;

i {
cursor: pointer;
font-size: 14px;
color: $secondary-text-color;
}
}

.info-name-container {
Expand Down
10 changes: 7 additions & 3 deletions src/components/Cards/HeadInfoCard/HeadInfoCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default class HeadInfoCard extends Component {
<div class="sub-mask">
<div class="result-profile-container">
<div class="i-mask"></div>
<i class="fa-solid fa-chevron-left"></i>
<div class="back-button-wrapper">
<i class="fa-solid fa-chevron-left"></i>
</div>
<div class="info-name-container">
<span class="info-name">환영합니다, ${
this.resultProfileData.name
Expand Down Expand Up @@ -69,8 +71,10 @@ export default class HeadInfoCard extends Component {
.map((aTagBlock) => aTagBlock.container)
);

const backButton = this.qs(".fa-chevron-left")! as HTMLElement;
backButton.addEventListener("pointerdown", () => {
const backButton = this.qs(".back-button-wrapper")! as HTMLElement;
backButton.addEventListener("pointerdown", (e: PointerEvent) => {
e.stopPropagation();

requestAnimationFrame(() => {
backMaskAnimation(
this.container,
Expand Down
5 changes: 3 additions & 2 deletions src/components/Cards/HeadInfoCard/ResultProfileTrigger.ani.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ function resultProfileAppearMixin(
const resultProfileContainer: HTMLDivElement = subMask.querySelector(
".result-profile-container"
)!;
const backButton: HTMLElement =
resultProfileContainer.querySelector(".fa-chevron-left")!;
const backButton: HTMLElement = resultProfileContainer.querySelector(
".back-button-wrapper"
)!;
const infoName: HTMLElement =
resultProfileContainer.querySelector(".info-name")!;
const infoRemember: HTMLElement =
Expand Down

0 comments on commit 1784408

Please sign in to comment.