Change animations
This commit is contained in:
@@ -18,34 +18,88 @@ const af = (() => {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
const animation = (steps) => {
|
const animation = (steps) => {
|
||||||
steps.reduce((total, [timeout, step]) => {
|
steps.map(([timeout, step]) => {
|
||||||
af(() => {
|
af(() => {
|
||||||
window.setTimeout(step, total + timeout)
|
window.setTimeout(step, timeout)
|
||||||
});
|
});
|
||||||
return total + timeout;
|
});
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createAnimation = (stateA, stateB, delay) => ({
|
||||||
|
style: stateA,
|
||||||
|
prepare(target) {
|
||||||
|
this.style = stateA;
|
||||||
|
},
|
||||||
|
run(target) {
|
||||||
|
af(() => {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
this.style = stateB;
|
||||||
|
}, delay)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const initDetails = (element, fromPjax) => {
|
const initDetails = (element, fromPjax) => {
|
||||||
if (fromPjax !== true) {
|
|
||||||
|
if(!fromPjax) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
element.classList.add('animate');
|
const items = JSON.parse(element.getAttribute('data-items'));
|
||||||
element.classList.add('animate--curtain');
|
|
||||||
element.classList.add('animate--invisible-content');
|
const details = new Vue({
|
||||||
element.classList.add('animate--invisible-nav');
|
el: element,
|
||||||
animation([
|
template: element.outerHTML,
|
||||||
[0, () => {
|
data: {
|
||||||
element.classList.remove('animate--curtain');
|
background: createAnimation({
|
||||||
}],
|
transform: 'translateX(calc((100vw - 1200px) / 2 + 800px))',
|
||||||
[350, () => {
|
}, {
|
||||||
element.classList.remove('animate--invisible-nav');
|
transform: 'translateX(0)',
|
||||||
}],
|
},
|
||||||
[150, () => {
|
0
|
||||||
element.classList.remove('animate--invisible-content');
|
),
|
||||||
}],
|
navHeader: createAnimation({
|
||||||
])
|
transform: 'translateY(-20px)',
|
||||||
|
opacity: '0',
|
||||||
|
}, {
|
||||||
|
transform: 'translateY(0px)',
|
||||||
|
opacity: '1',
|
||||||
|
},
|
||||||
|
300
|
||||||
|
),
|
||||||
|
text: createAnimation({
|
||||||
|
transform: 'translateY(-20px)',
|
||||||
|
opacity: '0',
|
||||||
|
}, {
|
||||||
|
transform: 'translateY(0px)',
|
||||||
|
opacity: '1',
|
||||||
|
},
|
||||||
|
600
|
||||||
|
),
|
||||||
|
items: items.map((item, i) => (createAnimation({
|
||||||
|
transform: 'translateY(-40px)',
|
||||||
|
opacity: '0',
|
||||||
|
}, {
|
||||||
|
transform: 'translateY(0px)',
|
||||||
|
opacity: '1',
|
||||||
|
},
|
||||||
|
200 + 100 * i
|
||||||
|
)))
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createAnimation
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
applyPjax();
|
||||||
|
this.background.run();
|
||||||
|
this.navHeader.run();
|
||||||
|
this.text.run();
|
||||||
|
this.items.map(item => item.run());
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
applyPjax();
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default initDetails;
|
export default initDetails;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ block content
|
|||||||
href=`/${item.quadrant}/${item.name}.html`
|
href=`/${item.quadrant}/${item.name}.html`
|
||||||
v-if=`isRingVisible('${item.attributes.ring}')`
|
v-if=`isRingVisible('${item.attributes.ring}')`
|
||||||
)
|
)
|
||||||
.split.split--align-top
|
.split.split--overview
|
||||||
.split__left
|
.split__left
|
||||||
.item__title
|
.item__title
|
||||||
= item.attributes.title
|
= item.attributes.title
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
width: 410px;
|
width: 410px;
|
||||||
padding: 0 40px 0 10px;
|
padding: 0 40px 0 10px;
|
||||||
transition: opacity 150ms ease-out, transform 300ms ease-out;
|
transition: opacity 150ms ease-out, transform 300ms ease-out;
|
||||||
|
/*&.is-uninitialized {
|
||||||
|
transform: translateY(-20px);
|
||||||
|
opacity: 0;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,34 +46,4 @@
|
|||||||
transition: opacity 150ms ease-out, transform 300ms ease-out;
|
transition: opacity 150ms ease-out, transform 300ms ease-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.animate {
|
|
||||||
&--curtain {
|
|
||||||
& .item-page {
|
|
||||||
&__content {
|
|
||||||
transform: translateX(calc((100vw - 1200px) / 2 + 800px));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&--invisible-content {
|
|
||||||
& .item-page {
|
|
||||||
&__content {
|
|
||||||
&__inner {
|
|
||||||
transform: translateY(-20px);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&--invisible-nav {
|
|
||||||
& .item-page {
|
|
||||||
&__nav {
|
|
||||||
&__inner {
|
|
||||||
transform: translateX(-20px);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: background 200ms ease-out;
|
transition: background 200ms ease-out;
|
||||||
color: var(--color-gray-normal);
|
color: var(--color-gray-normal);
|
||||||
|
box-sizing: border-box;
|
||||||
|
transition: opacity 150ms ease-out, transform 300ms ease-out;
|
||||||
|
|
||||||
&.is-active {
|
&.is-active {
|
||||||
background: var(--color-gray-dark-alt);
|
background: var(--color-gray-dark-alt);
|
||||||
@@ -19,14 +21,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&--big {
|
&--big {
|
||||||
|
min-height: 80px;
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
/*&:hover {
|
|
||||||
background: transparent;
|
|
||||||
|
|
||||||
& .item__title {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&--no-leading-border {
|
&--no-leading-border {
|
||||||
|
|||||||
@@ -4,13 +4,14 @@
|
|||||||
border-top: 1px solid var(--color-gray-normal);
|
border-top: 1px solid var(--color-gray-normal);
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0 0 0 200px;
|
padding: 0 0 0 200px;
|
||||||
min-height: 100px;
|
min-height: 80px;
|
||||||
}
|
}
|
||||||
&__letter {
|
&__letter {
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
|
line-height: 80px;
|
||||||
color: var(--color-gray-normal);
|
color: var(--color-gray-normal);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50px;
|
left: 50px;
|
||||||
top: 10px;
|
top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--overview {
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
&__left {
|
&__left {
|
||||||
flex: 0 1 auto;
|
flex: 0 1 auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ block vars
|
|||||||
- var title=item.attributes.title
|
- var title=item.attributes.title
|
||||||
|
|
||||||
block content
|
block content
|
||||||
.item-page.js--details
|
.item-page.js--details(data-items=JSON.stringify(itemsInRing))
|
||||||
.item-page__nav
|
.item-page__nav
|
||||||
.item-page__nav__inner
|
.item-page__nav__inner(v-bind:style="navHeader.style")
|
||||||
.item-page__header
|
.item-page__header
|
||||||
h3.headline
|
h3.headline
|
||||||
= translate(item.quadrant)
|
= translate(item.quadrant)
|
||||||
@@ -23,13 +23,17 @@ block content
|
|||||||
span.icon.icon--pie.icon-link__icon
|
span.icon.icon--pie.icon-link__icon
|
||||||
| Quadrant Overview
|
| Quadrant Overview
|
||||||
.item-list__list
|
.item-list__list
|
||||||
each ringItem in itemsInRing
|
each ringItem, i in itemsInRing
|
||||||
a.item(class=`${ringItem.name === item.name ? 'is-active' : ''}` href=`/${ringItem.quadrant}/${ringItem.name}.html`)
|
a.item(
|
||||||
|
class=`${ringItem.name === item.name ? 'is-active' : ''}`
|
||||||
|
href=`/${ringItem.quadrant}/${ringItem.name}.html`
|
||||||
|
v-bind:style=`items[${i}].style`
|
||||||
|
)
|
||||||
.item__title= ringItem.attributes.title
|
.item__title= ringItem.attributes.title
|
||||||
if ringItem.attributes.info
|
if ringItem.attributes.info
|
||||||
.item__info= ringItem.attributes.info
|
.item__info= ringItem.attributes.info
|
||||||
.item-page__content
|
.item-page__content(v-bind:style="background.style")
|
||||||
.item-page__content__inner
|
.item-page__content__inner(v-bind:style="text.style")
|
||||||
.item-page__header
|
.item-page__header
|
||||||
.split
|
.split
|
||||||
.split__left
|
.split__left
|
||||||
|
|||||||
Reference in New Issue
Block a user