Skip to content

chore: update animation for image profile #68

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

Merged
merged 1 commit into from
Oct 29, 2023
Merged
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
34 changes: 17 additions & 17 deletions src/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ export default function cardStyle(data: GetData, uiConfig: UiConfig): string {
const defaultLocale: Locales[keyof Locales] = locales[fallbackLocale];
const selectLocale: Locales[keyof Locales] = locales[uiConfig.Locale] || defaultLocale;

const isRtlDirection = parseBoolean(selectLocale.rtlDirection);
const isDisabledAnimations = parseBoolean(uiConfig.disabledAnimations || uiConfig.Format === "png");

const direction = isRtlDirection ? "rtl" : "ltr";
const titleXAngle = isDisabledAnimations ? (isRtlDirection ? 520 : 15) : (isRtlDirection ? 510 : 5);
const titleYAngle = isDisabledAnimations ? 0 : -10;
const textXAngle = isRtlDirection ? 215 : 25;
const dataXAngle = isRtlDirection ? 15 : 225;
const iconXAngle = isRtlDirection ? 225 : 0;
const imageXAngle = isDisabledAnimations ? 120 : 125;
const imageYAngle = isDisabledAnimations ? 70 : 65;
const userXAngle = isDisabledAnimations ? 119.9 : 109.9;
const userYAngle = isDisabledAnimations ? 140 : 130;
const follXAngle = isDisabledAnimations ? 120 : 110;
const follYAngle = isDisabledAnimations ? 161 : 151;
const animations = parseBoolean(uiConfig.disabledAnimations || uiConfig.Format === "png") ? `` : ` /* Animations */
@keyframes scaleInAnimation {
from {
Expand Down Expand Up @@ -42,30 +57,15 @@ export default function cardStyle(data: GetData, uiConfig: UiConfig): string {
}

.image-profile-animation {
animation: scaleInAnimation 0.9s ease-in-out forwards;
animation: scaleInAnimation 1.2s ease-in-out forwards;
transform-origin: ${imageXAngle}px ${imageYAngle}px;
}

.single-item-animation {
opacity: 0;
animation: fadeInAnimation 0.3s ease-in-out forwards;
}`;

const isRtlDirection = parseBoolean(selectLocale.rtlDirection);
const isDisabledAnimations = parseBoolean(uiConfig.disabledAnimations || uiConfig.Format === "png");

const direction = isRtlDirection ? "rtl" : "ltr";
const titleXAngle = isDisabledAnimations ? (isRtlDirection ? 520 : 15) : (isRtlDirection ? 510 : 5);
const titleYAngle = isDisabledAnimations ? 0 : -10;
const textXAngle = isRtlDirection ? 215 : 25;
const dataXAngle = isRtlDirection ? 15 : 225;
const iconXAngle = isRtlDirection ? 225 : 0;
const imageXAngle = isDisabledAnimations ? 120 : 125;
const imageYAngle = isDisabledAnimations ? 70 : 65;
const userXAngle = isDisabledAnimations ? 119.9 : 109.9;
const userYAngle = isDisabledAnimations ? 140 : 130;
const follXAngle = isDisabledAnimations ? 120 : 110;
const follYAngle = isDisabledAnimations ? 161 : 151;

const hiddenItems = uiConfig.hiddenItems || "";
const hiddenItemsArray = hiddenItems.split(",");
const showItems = uiConfig.showItems || "";
Expand Down