commit c739dfd76bfed2a31fd9f13ab4811c8c659bf335
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-06-04T05:21:36Z |
| subject | Added transition decade |
commit c739dfd76bfed2a31fd9f13ab4811c8c659bf335
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-06-04T05:21:36Z
Added transition decade
---
botanjs/src/Astro/Blog/Layout/MainFrame.js | 4 +++-
botanjs/src/Astro/Mechanism/Parallax.js | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.js b/botanjs/src/Astro/Blog/Layout/MainFrame.js
index 9439346..daa3287 100644
--- a/botanjs/src/Astro/Blog/Layout/MainFrame.js
+++ b/botanjs/src/Astro/Blog/Layout/MainFrame.js
@@ -234,13 +234,15 @@
Parallax.attach( window, wsupp, 0.5 );
+ var cp = 0;
var bWrapper = Dand.id( "begin-wrapper" );
Cycle.perma(
"MainBackground"
, function()
{
var p = wsupp.scrollTop / ( wsupp.scrollHeight - wsupp.clientHeight );
- bWrapper.style.backgroundPosition = "50% " + ( p * 100 ) + "%";
+ cp = 0.75 * cp + 0.25 * p;
+ bWrapper.style.backgroundPosition = "50% " + cp * 100 + "%";
}
, 15
);
diff --git a/botanjs/src/Astro/Mechanism/Parallax.js b/botanjs/src/Astro/Mechanism/Parallax.js
index a3c414b..c003101 100644
--- a/botanjs/src/Astro/Mechanism/Parallax.js
+++ b/botanjs/src/Astro/Mechanism/Parallax.js
@@ -64,18 +64,21 @@
}
}
+ var cp = 0;
Cycle.perma(
"PARALLAXSCR"
, function()
{
var p = sSupplier.scrollTop/(sSupplier.scrollHeight - sSupplier.clientHeight);
+ cp = 0.85 * cp + p * 0.15;
+
for(var i = 0; i < l; i ++)
{
s = Parallax["s" + i];
for(var j = 0, k; j < s.length; j ++)
{
k = s[j];
- k.element.style.top = String(-k.verticalRange*((j + 1)*p)) + "%";
+ k.element.style.top = String(-k.verticalRange*((j + 1)*cp)) + "%";
}
}
}