diff --git a/motion/_animation.scss b/motion/_animation.scss index b4cf90529..08bc942ef 100644 --- a/motion/_animation.scss +++ b/motion/_animation.scss @@ -10,6 +10,7 @@ 100% { opacity: 1; + visibility: visible; } } @@ -20,23 +21,12 @@ 100% { opacity: 0; + visibility: hidden; } } /* Scale */ @keyframes tds-zoom-in { - 0% { - opacity: 1; - transform: scale(0.9); - } - - 100% { - opacity: 1; - transform: scale(1); - } -} - -@keyframes tds-zoom-in-hidden { 0% { transform: scale(0.9); } @@ -59,72 +49,60 @@ /* Slide */ @keyframes tds-slide-in-top { 0% { - opacity: 1; transform: translateY(-100%); } 100% { - opacity: 1; transform: translateY(0); } } @keyframes tds-slide-in-bottom { 0% { - opacity: 1; transform: translateY(100%); } 100% { - opacity: 1; transform: translateY(0); } } @keyframes tds-slide-in-left { 0% { - opacity: 1; transform: translateX(-100%); } 100% { - opacity: 1; transform: translateX(0); } } @keyframes tds-slide-in-right { 0% { - opacity: 1; transform: translateX(100%); } 100% { - opacity: 1; transform: translateX(0); } } @keyframes tds-slide-out-top { 0% { - opacity: 1; transform: translateY(0); } 100% { - opacity: 1; transform: translateY(-100%); } } @keyframes tds-slide-out-bottom { 0% { - opacity: 1; transform: translateY(0); } 100% { - opacity: 1; transform: translateY(100%); } } @@ -141,24 +119,20 @@ @keyframes tds-slide-out-left { 0% { - opacity: 1; transform: translateX(0); } 100% { - opacity: 1; transform: translateX(-100%); } } @keyframes tds-slide-out-right { 0% { - opacity: 1; transform: translateX(0); } 100% { - opacity: 1; transform: translateX(100%); } } @@ -166,60 +140,82 @@ /* Slide short */ @keyframes tds-slide-top-short { 0% { - opacity: 1; transform: translateY(-16px); } 100% { - opacity: 1; transform: translateY(0); } } @keyframes tds-slide-bottom-short { 0% { - opacity: 1; transform: translateY(16px); } 100% { - opacity: 1; transform: translateY(0); } } -@keyframes tds-slide-bottom-short-hidden { +@keyframes tds-slide-left-short { 0% { - transform: translateY(16px); + transform: translateX(-16px); } 100% { - transform: translateY(0); + transform: translateX(0); } } -@keyframes tds-slide-left-short { +@keyframes tds-slide-right-short { 0% { - opacity: 1; - transform: translateX(-16px); + transform: translateX(16px); } 100% { - opacity: 1; transform: translateX(0); } } -@keyframes tds-slide-right-short { +@keyframes tds-slide-out-top-short { 0% { - opacity: 1; - transform: translateX(16px); + transform: translateY(0); } 100% { - opacity: 1; + transform: translateY(-16px); + } +} + +@keyframes tds-slide-out-bottom-short { + 0% { + transform: translateY(0); + } + + 100% { + transform: translateY(16px); + } +} + +@keyframes tds-slide-out-left-short { + 0% { + transform: translateX(0); + } + + 100% { + transform: translateX(-16px); + } +} + +@keyframes tds-slide-out-right-short { + 0% { transform: translateX(0); } + + 100% { + transform: translateX(16px); + } } /* Rotate */ @@ -346,74 +342,60 @@ @keyframes tds-collapse-in { from { - opacity: 1; - height: 0%; - - //overflow: hidden; + transform-origin: top; + transform: scaleY(0); } to { - opacity: 1; - height: 100%; - - //overflow: hidden; + transform-origin: top; + transform: scaleY(1); } } @keyframes tds-collapse-in-hidden { from { - height: 0%; - - //overflow: hidden; + transform-origin: top; + transform: scaleY(0); } to { - height: 100%; - - //overflow: hidden; + transform-origin: top; + transform: scaleY(1); } } @keyframes tds-collapse-out { 0% { - height: 100%; - - //overflow: hidden; + transform: scaleY(1); + transform-origin: top; } 100% { - height: 0; - - //overflow: hidden; + transform: scaleY(0); + transform-origin: top; } } @keyframes tds-collapse-width-in { 0% { - width: 0; - overflow: hidden; + transform: scaleX(0); } to { - width: 100%; - overflow: hidden; + transform: scaleX(1); } } @keyframes tds-collapse-width-out { 0% { - width: 100%; - overflow: hidden; + transform: scaleX(1); } to { - width: 0; - overflow: hidden; + transform: scaleX(0); } } -/// - @supports not ( ((height: 1lh) and (animation-timeline: none)) or ((height: 1lh) and (margin-trim: none)) ) { @@ -496,11 +478,3 @@ stroke-dasharray: 2230px; } } - -.star1 { - animation: animate-svg-stroke-1 2s cubic-bezier(0.47, 0, 0.745, 0.715) 0s both; - fill: #fff; - stroke: #000; - stroke-width: 20; - stroke-miterlimit: 10; -} diff --git a/motion/_motion.scss b/motion/_motion.scss index 3b64485fc..b02c9935a 100644 --- a/motion/_motion.scss +++ b/motion/_motion.scss @@ -42,80 +42,110 @@ html { --tds-motion-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* ======================================================================== - Motion Animations Variables + Motion Transition Variables ======================================================================= */ /* ### Fade ### */ - --fade-in-animation: tds-fade-in var(--tds-motion-duration-moderate-01) - var(--tds-motion-easing-linear) forwards; - --fade-out-animation: tds-fade-out var(--tds-motion-duration-moderate-01) - var(--tds-motion-easing-linear) forwards; + --tds-motion-fade-in: tds-fade-in var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-enter) forwards; + --tds-motion-fade-out: tds-fade-out var(--tds-motion-duration-moderate-01) + var(--tds-motion-easing-exit) forwards; /* ### Zoom ### */ - --zoom-in-animation: tds-zoom-in var(--tds-motion-duration-fast-02) var(--tds-motion-easing-enter) - forwards; - --zoom-out-animation: tds-zoom-out var(--tds-motion-duration-fast-02) + --tds-motion-zoom-in: tds-zoom-in var(--tds-motion-duration-fast-02) + var(--tds-motion-easing-enter) forwards; + --tds-motion-zoom-out: tds-zoom-out var(--tds-motion-duration-fast-02) var(--tds-motion-easing-exit) forwards; /* ### Slide ### */ - --slide-in-top-animation: tds-slide-in-top var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-top: tds-slide-in-top var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-in-bottom-animation: tds-slide-in-bottom var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-bottom: tds-slide-in-bottom var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-in-left-animation: tds-slide-in-left var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-left: tds-slide-in-left var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-in-right-animation: tds-slide-in-right var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-right: tds-slide-in-right var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-out-top-animation: tds-slide-out-top var(--tds-motion-duration-slow-02) + --tds-motion-slide-out-top: tds-slide-out-top var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; - --slide-out-bottom-animation: tds-slide-out-bottom var(--tds-motion-duration-slow-02) + --tds-motion-slide-out-bottom: tds-slide-out-bottom var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; - --slide-out-left-animation: tds-slide-out-left var(--tds-motion-duration-slow-02) + --tds-motion-slide-out-left: tds-slide-out-left var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; - --slide-out-right-animation: tds-slide-out-right var(--tds-motion-duration-slow-02) + --tds-motion-slide-out-right: tds-slide-out-right var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; /* ### Slide Short ### */ - --slide-top-short-animation: tds-slide-top-short var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-short-top: tds-slide-top-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-bottom-short-animation: tds-slide-bottom-short var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-short-right: tds-slide-right-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-left-short-animation: tds-slide-left-short var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-short-bottom: tds-slide-bottom-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --slide-right-short-animation: tds-slide-right-short var(--tds-motion-duration-slow-02) + --tds-motion-slide-in-short-left: tds-slide-left-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; + --tds-motion-slide-out-short-top: tds-slide-out-top-short var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards; + --tds-motion-slide-out-short-bottom: tds-slide-out-bottom-short var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards; + --tds-motion-slide-out-short-left: tds-slide-out-left-short var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards; + --tds-motion-slide-out-short-right: tds-slide-out-right-short var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards; /* ### Collapse ### */ - --collapse-in-animation: tds-collapse-in var(--tds-motion-duration-slow-02) + --tds-motion-collapse-in: tds-collapse-in var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) forwards; - --collapse-out-animation: tds-collapse-out var(--tds-motion-duration-slow-02) + --tds-motion-collapse-out: tds-collapse-out var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; /* ### Rotate ### */ - --rotate-animation: tds-rotate var(--tds-motion-duration-slow-02) var(--tds-motion-easing-linear) + --tds-motion-rotate: tds-rotate var(--tds-motion-duration-slow-02) var(--tds-motion-easing-linear) forwards; /* ### Shake ### */ - --shake-animation: tds-shake var(--tds-motion-duration-slow-02) var(--tds-motion-easing-linear) + --tds-motion-shake: tds-shake var(--tds-motion-duration-slow-02) var(--tds-motion-easing-linear) forwards; /* ### Blink ### */ - --blink-animation: tds-blink calc(var(--tds-motion-duration-slow-02) * 2) + --tds-motion-blink: tds-blink calc(var(--tds-motion-duration-slow-02) * 2) var(--tds-motion-easing-scania) infinite; /* ### Pulse ### */ - --pulse-animation: tds-pulse calc(var(--tds-motion-duration-slow-02) * 2) + --tds-motion-pulse: tds-pulse calc(var(--tds-motion-duration-slow-02) * 2) var(--tds-motion-easing-scania) infinite; - /* ### Elevate ### */ - --elevate-enter-animation: tds-fade-in var(--tds-motion-duration-slow-02) + /* ======================================================================== + Motion Animation Variables + ======================================================================= */ + + --tds-motion-zoom-enter: tds-fade-in var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-enter) forwards, + tds-zoom-in var(--tds-motion-duration-fast-02) var(--tds-motion-easing-scania) forwards; + --tds-motion-zoom-exit: tds-fade-out var(--tds-motion-duration-fast-02) + var(--tds-motion-easing-exit) forwards, + tds-zoom-out var(--tds-motion-duration-fast-02) var(--tds-motion-easing-exit) forwards; + --tds-motion-collapse-enter: tds-fade-in var(--tds-motion-duration-slow-02) var(--tds-motion-easing-linear) forwards, + tds-collapse-in-hidden var(--tds-motion-duration-slow-02) var(--tds-motion-easing-scania) + forwards; + --tds-motion-collapse-exit: tds-fade-out var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards, + tds-collapse-out var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; + --tds-motion-slide-enter: tds-fade-in var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-enter) forwards, + tds-slide-bottom-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-enter) + forwards; + --tds-motion-slide-exit: tds-fade-out var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-exit) forwards, + tds-slide-out-bottom-short var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) + forwards; + --tds-motion-elevate-enter: tds-fade-in var(--tds-motion-duration-slow-02) + var(--tds-motion-easing-enter) forwards, tds-slide-in-bottom-hidden var(--tds-motion-duration-slow-02) var(--tds-motion-easing-scania) forwards, - tds-zoom-in-hidden var(--tds-motion-duration-slow-02) var(--tds-motion-easing-scania) forwards; - --elevate-exit-animation: tds-fade-out var(--tds-motion-duration-slow-02) + tds-zoom-in var(--tds-motion-duration-slow-02) var(--tds-motion-easing-scania) forwards; + --tds-motion-elevate-exit: tds-fade-out var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-exit) forwards, - tds-slide-out-bottom-hidden var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) - forwards, - tds-zoom-out var(--tds-motion-duration-slow-02) var(--tds-motion-easing-exit) forwards; + tds-zoom-out var(--tds-motion-duration-slow-02) var(--tds-motion-easing-scania) forwards; } diff --git a/packages/core/.storybook/preview.js b/packages/core/.storybook/preview.js index 53e01c7a0..0b16cb6fe 100644 --- a/packages/core/.storybook/preview.js +++ b/packages/core/.storybook/preview.js @@ -147,6 +147,7 @@ export const parameters = { 'Announcements', ['Tegel', 'Prefix change'], ], + 'Motions', 'Foundations', 'Utilities', 'Patterns', diff --git a/packages/core/src/stories/motions/animations/animations-classes.stories.ts b/packages/core/src/stories/motions/animations/animations-classes.stories.ts new file mode 100644 index 000000000..6f598604e --- /dev/null +++ b/packages/core/src/stories/motions/animations/animations-classes.stories.ts @@ -0,0 +1,221 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Animations/All', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+ +

Enter

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform animation, as demonstrated below. +

+
+ +
+
+
+
+

--tds-motion-zoom-enter

+
+
+
+
+
+
+
+

--tds-motion-collapse-exit

+
+ +
+
+
+
+

--tds-motion-slide-enter

+
+ +
+
+
+
+

--tds-motion-elevate-enter

+
+ +
+ +

Exit

+ +
+
+
+
+
+

--tds-motion-zoom-exit

+
+
+
+
+
+
+
+

--tds-motion-collapse-exit

+
+
+
+
+
+

--tds-motion-slide-exit

+
+
+
+
+
+
+
+

--tds-motion-elevate-exit

+
+
+
+ + + + `, + ); + +export const All = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-collapse.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-collapse.stories.tsx new file mode 100644 index 000000000..a70349b8b --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-collapse.stories.tsx @@ -0,0 +1,97 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Collapse', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Collapse

+ +

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+ +
+
+
+
+
+
+
+

--tds-motion-collapse-in

+
+ +
+
+
+
+
+
+

--tds-motion-collapse-out

+
+
+
+ + + `, + ); + +export const Collapse = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-fade.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-fade.stories.tsx new file mode 100644 index 000000000..99c67b5c4 --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-fade.stories.tsx @@ -0,0 +1,86 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Fade', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Fade

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+
+
+
+
+
+

--tds-motion-fade-in

+
+ +
+
+
+
+

--tds-motion-fade-out

+
+
+
+ + + `, + ); + +export const Fade = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-other.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-other.stories.tsx new file mode 100644 index 000000000..e7332a055 --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-other.stories.tsx @@ -0,0 +1,147 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Other', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Other

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+
+ +
+
+
+
+

--tds-motion-rotate

+
+ + +
+
+
+
+

--tds-motion-shake

+
+ + +
+
+
+
+

--tds-motion-pulse

+
+ + +
+
+ +
+

--tds-motion-blink

+
+ + +
+
+
+
+

--tds-motion-elevate-exit

+
+ +
+
+ + + `, + ); + +export const Other = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-slide.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-slide.stories.tsx new file mode 100644 index 000000000..0a382f1fd --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-slide.stories.tsx @@ -0,0 +1,184 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Slide', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Slide

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+

Slide In

+
+ +
+
+
+
+

--tds-motion-slide-in-top

+
+
+
+
+
+

--tds-motion-slide-in-right

+
+
+
+
+
+

--tds-motion-slide-in-bottom

+
+
+
+
+
+

--tds-motion-slide-in-left

+
+
+ +

Slide Out

+
+ +
+
+
+
+

--tds-motion-slide-out-top

+
+
+
+
+
+

--tds-motion-slide-out-right

+
+
+
+
+
+

--tds-motion-slide-out-bottom

+
+
+
+
+
+

--tds-motion-slide-out-left

+
+
+
+ + + `, + ); + +export const Slide = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-slideshort.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-slideshort.stories.tsx new file mode 100644 index 000000000..d6d40b251 --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-slideshort.stories.tsx @@ -0,0 +1,184 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Slide Short', + parameters: { + layout: 'fullscreen', + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Slide Short

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+

Slide In

+
+ +
+
+
+
+

--tds-motion-slide-in-short-top

+
+
+
+
+
+

--tds-motion-slide-in-short-right

+
+
+
+
+
+

--tds-motion-slide-in-short-bottom

+
+
+
+
+
+

--tds-motion-slide-in-short-left

+
+
+ +

Slide Out

+
+ +
+
+
+
+

--tds-motion-slide-out-short-top

+
+
+
+
+
+

--tds-motion-slide-out-short-right

+
+
+
+
+
+

--tds-motion-slide-out-short-bottom

+
+
+
+
+
+

--tds-motion-slide-out-short-left

+
+
+
+ + + `, + ); + +export const SlideShort = Template.bind({}); diff --git a/packages/core/src/stories/motions/transitions/transitions-zoom.stories.tsx b/packages/core/src/stories/motions/transitions/transitions-zoom.stories.tsx new file mode 100644 index 000000000..5d6109769 --- /dev/null +++ b/packages/core/src/stories/motions/transitions/transitions-zoom.stories.tsx @@ -0,0 +1,85 @@ +import formatHtmlPreview from '../../formatHtmlPreview'; + +export default { + title: 'Motions/Transitions/Zoom', + parameters: { + design: [ + { + name: 'Figma', + type: 'figma', + url: 'https://www.figma.com/design/3vglvmuE8d0wXQRhFM0Op6/Tegel-Motions?node-id=9-167&p=f&t=J2E8IQiExfDl7AHR-0', + }, + ], + }, +}; + +const Template = () => + formatHtmlPreview( + ` +
+

Zoom

+

+ Use these variables in the animation property of your elements to + achieve smooth and uniform transitions, as demonstrated below. +

+ +
+
+
+
+
+

--tds-motion-zoom-in

+
+ +
+
+
+
+

--tds-motion-zoom-out

+
+
+
+ + + `, + ); + +export const Zoom = Template.bind({});