mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Refactor motion
This commit is contained in:
parent
327d8bf2be
commit
b39ba186d9
@ -15,9 +15,9 @@
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
<a href="{{ config.root }}" class="brand" rel="start">
|
<a href="{{ config.root }}" class="brand" rel="start">
|
||||||
<i class="logo-line-before"></i>
|
<i class="logo-line"></i>
|
||||||
<h1 class="site-title">{{ title }}</h1>
|
<h1 class="site-title">{{ title }}</h1>
|
||||||
<i class="logo-line-after"></i>
|
<i class="logo-line"></i>
|
||||||
</a>
|
</a>
|
||||||
{%- if subtitle %}
|
{%- if subtitle %}
|
||||||
<p class="site-subtitle" itemprop="description">{{ subtitle }}</p>
|
<p class="site-subtitle" itemprop="description">{{ subtitle }}</p>
|
||||||
|
|||||||
@ -4,12 +4,15 @@
|
|||||||
<span>0%</span>
|
<span>0%</span>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- if theme.reading_progress.enable %}
|
{%- if theme.reading_progress.enable %}
|
||||||
<div class="reading-progress-bar"></div>
|
<div class="reading-progress-bar"></div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- if theme.bookmark.enable %}
|
{%- if theme.bookmark.enable %}
|
||||||
<a role="button" class="book-mark-link book-mark-link-fixed"></a>
|
<a role="button" class="book-mark-link book-mark-link-fixed"></a>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- if theme.github_banner.enable %}
|
{%- if theme.github_banner.enable %}
|
||||||
{%- set github_URL = theme.github_banner.permalink %}
|
{%- set github_URL = theme.github_banner.permalink %}
|
||||||
{%- set github_title = theme.github_banner.title %}
|
{%- set github_title = theme.github_banner.title %}
|
||||||
@ -18,3 +21,7 @@
|
|||||||
|
|
||||||
{{ next_url(github_URL, github_image, {class: 'github-corner', title: github_title, "aria-label": github_title}) }}
|
{{ next_url(github_URL, github_image, {class: 'github-corner', title: github_title, "aria-label": github_title}) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<div id="noscript-warning">Theme NexT works best with JavaScript enabled</div>
|
||||||
|
</noscript>
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
<style>
|
<style>
|
||||||
body { margin-top: 2rem; }
|
body { margin-top: 2rem; }
|
||||||
|
|
||||||
.use-motion .brand,
|
|
||||||
.use-motion .menu-item,
|
.use-motion .menu-item,
|
||||||
.sidebar-inner,
|
.sidebar-inner,
|
||||||
.use-motion .post-block,
|
.use-motion .post-block,
|
||||||
@ -13,17 +12,17 @@
|
|||||||
.use-motion .collection-header { opacity: initial; }
|
.use-motion .collection-header { opacity: initial; }
|
||||||
|
|
||||||
.use-motion .site-title,
|
.use-motion .site-title,
|
||||||
.use-motion .site-subtitle {
|
.use-motion .site-subtitle,
|
||||||
|
.use-motion .site-brand-container .toggle {
|
||||||
opacity: initial;
|
opacity: initial;
|
||||||
top: initial;
|
top: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.use-motion .logo-line-before, .use-motion .logo-line-after {
|
.use-motion .logo-line {
|
||||||
transform: scaleX(1);
|
transform: scaleX(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-pop-overlay, .sidebar-nav { display: none; }
|
.search-pop-overlay, .sidebar-nav { display: none; }
|
||||||
.sidebar-panel { display: block; }
|
.sidebar-panel { display: block; }
|
||||||
</style>
|
</style>
|
||||||
<div id="noscript-warning">Theme NexT works best with JavaScript enabled</div>
|
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|||||||
@ -40,10 +40,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.use-motion {
|
.use-motion {
|
||||||
.brand {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-title, .site-subtitle, .custom-logo-image {
|
.site-title, .site-subtitle, .custom-logo-image {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -26,3 +26,11 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.use-motion {
|
||||||
|
.site-brand-container .toggle {
|
||||||
|
opacity: 0;
|
||||||
|
position: relative;
|
||||||
|
top: -10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-line-before, .logo-line-after {
|
.logo-line {
|
||||||
background: var(--brand-color);
|
background: var(--brand-color);
|
||||||
display: block;
|
display: block;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
@ -40,12 +40,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.use-motion {
|
.use-motion {
|
||||||
.logo-line-before {
|
.logo-line:first-of-type {
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
transform: scaleX(0);
|
transform: scaleX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-line-after {
|
.logo-line:last-of-type {
|
||||||
transform-origin: right;
|
transform-origin: right;
|
||||||
transform: scaleX(0);
|
transform: scaleX(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,60 +29,50 @@ NexT.motion.integrator = {
|
|||||||
NexT.motion.middleWares = {
|
NexT.motion.middleWares = {
|
||||||
logo: function(integrator) {
|
logo: function(integrator) {
|
||||||
const sequence = [];
|
const sequence = [];
|
||||||
const brand = document.querySelector('.brand');
|
|
||||||
const image = document.querySelector('.custom-logo-image');
|
const image = document.querySelector('.custom-logo-image');
|
||||||
const title = document.querySelector('.site-title');
|
const title = document.querySelector('.site-title');
|
||||||
const subtitle = document.querySelector('.site-subtitle');
|
const subtitle = document.querySelector('.site-subtitle');
|
||||||
const logoLineTop = document.querySelector('.logo-line-before');
|
const toggle = document.querySelectorAll('.site-brand-container .toggle');
|
||||||
const logoLineBottom = document.querySelector('.logo-line-after');
|
const logoLine = document.querySelectorAll('.logo-line');
|
||||||
|
|
||||||
brand && sequence.push({
|
|
||||||
e: brand,
|
|
||||||
p: {opacity: 1},
|
|
||||||
o: {duration: 200}
|
|
||||||
});
|
|
||||||
|
|
||||||
function getMistLineSettings(element) {
|
function getMistLineSettings(element) {
|
||||||
Velocity.hook(element, 'scaleX', 0);
|
Velocity.hook(element, 'scaleX', 0);
|
||||||
return {
|
sequence.push({
|
||||||
e: element,
|
e: element,
|
||||||
p: {scaleX: 1},
|
p: {
|
||||||
|
scaleX: 1
|
||||||
|
},
|
||||||
o: {
|
o: {
|
||||||
duration : 500,
|
duration : 500,
|
||||||
sequenceQueue: false
|
sequenceQueue: false
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushImageToSequence() {
|
|
||||||
sequence.push({
|
|
||||||
e: image,
|
|
||||||
p: {opacity: 1, top: 0},
|
|
||||||
o: {duration: 200}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG.scheme === 'Mist' && logoLineTop && logoLineBottom
|
function pushToSequence(element) {
|
||||||
&& sequence.push(
|
sequence.push({
|
||||||
getMistLineSettings(logoLineTop),
|
e: element,
|
||||||
getMistLineSettings(logoLineBottom)
|
p: {
|
||||||
);
|
opacity: 1,
|
||||||
|
top : 0
|
||||||
|
},
|
||||||
|
o: {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG.scheme === 'Muse' && image && pushImageToSequence();
|
CONFIG.scheme === 'Mist' && logoLine.length && getMistLineSettings(logoLine);
|
||||||
|
|
||||||
title && sequence.push({
|
CONFIG.scheme === 'Muse' && image && pushToSequence(image);
|
||||||
e: title,
|
|
||||||
p: {opacity: 1, top: 0},
|
|
||||||
o: {duration: 200}
|
|
||||||
});
|
|
||||||
|
|
||||||
subtitle && sequence.push({
|
title && pushToSequence(title);
|
||||||
e: subtitle,
|
|
||||||
p: {opacity: 1, top: 0},
|
|
||||||
o: {duration: 200}
|
|
||||||
});
|
|
||||||
|
|
||||||
(CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') && image && pushImageToSequence();
|
subtitle && pushToSequence(subtitle);
|
||||||
|
|
||||||
|
toggle.length && pushToSequence(toggle);
|
||||||
|
|
||||||
|
(CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') && image && pushToSequence(image);
|
||||||
|
|
||||||
if (sequence.length > 0) {
|
if (sequence.length > 0) {
|
||||||
sequence[sequence.length - 1].o.complete = function() {
|
sequence[sequence.length - 1].o.complete = function() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user