Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript
4.7 KB
Raw Blame
#props-dock {
    position: fixed;
    top: calc(var(--navigation-height) + 0.5rem);
    /* right offset is set from the tool panel width in PropsPanel */
    right: 26rem;
    z-index: 10;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
}

/* panel sits to the left of the toggle button */
#props-panel {
    order: -1;
}

#props-toggle-button,
#props-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

#props-toggle-button[hidden] {
    display: none;
}

/* close button sits at the far right of the open panel, where the toggle was */
#props-close-button {
    align-self: center;
    margin-left: auto;
}

.props-panel {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    padding: 1.0rem;
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    background: color-mix(in srgb, var(--bg-primary) 90%, black);
    box-shadow: 1px 1px 8px 0px var(--bg-primary);
}

.props-panel[hidden] {
    display: none;
}

/* prop picker: custom dropdown with preview images */

.prop-picker {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.prop-picker-label {
    white-space: nowrap;
}

.prop-picker-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 15rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    background: var(--bg-alternate);
    box-shadow: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.prop-picker-trigger:hover:not(:disabled),
.prop-picker-trigger[aria-expanded="true"] {
    border-color: var(--text-primary);
}

.prop-picker-trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.prop-picker-name {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.prop-picker-chevron {
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.15rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-25%) rotate(45deg);
    transition: transform 0.15s ease;
}

.prop-picker-trigger[aria-expanded="true"] .prop-picker-chevron {
    transform: translateY(25%) rotate(-135deg);
}

.prop-picker-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 3px;
    /* background: color-mix(in srgb, var(--bg-primary) 70%, transparent); */
}

.prop-picker-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* "None" slot: a circle with a slash */
.prop-picker-empty {
    width: 50%;
    height: 50%;
    border: 2px solid var(--text-alternate);
    border-radius: 50%;
    background: linear-gradient(45deg, transparent calc(50% - 1px), var(--text-alternate) calc(50% - 1px), var(--text-alternate) calc(50% + 1px), transparent calc(50% + 1px));
    opacity: 0.6;
}

.prop-picker-popup {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 20;
    width: 16rem;
    max-height: calc(100vh - var(--navigation-height) - 17rem);
    max-height: calc(100dvh - var(--navigation-height) - 17rem); /* dvh accounts for iPad/iOS browser toolbars; 100vh line above is the fallback */
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    background: var(--bg-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    outline: none;
}

.prop-picker-popup[hidden] {
    display: none;
}

.prop-picker-group {
    margin-top: 0.5rem;
}

.prop-picker-group-label {
    margin: 0 0 0.25rem 0.15rem;
    padding: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-alternate);
    text-align: center;
}



.prop-picker-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.3rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
}

.prop-picker-option .prop-picker-thumb {
    width: 3.5rem;
    height: 3.5rem;
}

.prop-picker-option-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.prop-picker-option.active {
    background: var(--bg-alternate);
}

.prop-picker-option[aria-selected="true"] {
    border-color: var(--text-primary);
}

@media (max-width: 48rem) {
    #props-dock {
        right: 0.5rem !important;
        left: 0.5rem;
    }

    .props-panel {
        flex: 1;
        flex-direction: column;
        min-width: 0;
    }

    .prop-picker-trigger {
        width: min(15rem, calc(100vw - 9rem));
    }

    .prop-picker-popup {
        right: 0;
        width: min(22rem, calc(100vw - 2rem));
    }
}