Reduced attr changes to improve performance

This commit is contained in:
Tobias Reich 2015-03-29 19:22:39 +02:00
parent a0c71edf64
commit 6aba10bea4
8 changed files with 40 additions and 28 deletions

BIN
dist/main.css vendored

Binary file not shown.

BIN
dist/main.js vendored

Binary file not shown.

View File

@ -34,10 +34,7 @@ album.load = function(albumID, refresh) {
password.get(albumID, function() { password.get(albumID, function() {
if (!refresh) { if (!refresh) lychee.animate('#content', 'contentZoomOut');
lychee.animate('.album, .photo', 'contentZoomOut');
lychee.animate('#content .divider', 'fadeOut');
}
startTime = new Date().getTime(); startTime = new Date().getTime();
@ -82,7 +79,7 @@ album.load = function(albumID, refresh) {
view.album.init(); view.album.init();
if (!refresh) { if (!refresh) {
lychee.animate('.album, .photo', 'contentZoomIn'); lychee.animate('#content', 'contentZoomIn');
header.setMode('album'); header.setMode('album');
} }

View File

@ -15,8 +15,7 @@ albums.load = function() {
durationTime, durationTime,
waitTime; waitTime;
lychee.animate('.album, .photo', 'contentZoomOut'); lychee.animate('#content', 'contentZoomOut');
lychee.animate('#content .divider', 'fadeOut');
startTime = new Date().getTime(); startTime = new Date().getTime();
@ -41,7 +40,7 @@ albums.load = function() {
setTimeout(function() { setTimeout(function() {
header.setMode('albums'); header.setMode('albums');
view.albums.init(); view.albums.init();
lychee.animate('.album', 'contentZoomIn'); lychee.animate('#content', 'contentZoomIn');
}, waitTime); }, waitTime);
}); });
@ -50,7 +49,7 @@ albums.load = function() {
setTimeout(function() { setTimeout(function() {
header.setMode('albums'); header.setMode('albums');
view.albums.init(); view.albums.init();
lychee.animate('.album, .photo', 'contentZoomIn'); lychee.animate('#content', 'contentZoomIn');
}, 300); }, 300);
} }

View File

@ -53,8 +53,7 @@ search.find = function(term) {
$('.no_content').remove(); $('.no_content').remove();
lychee.animate('.album, .photo', 'contentZoomOut'); lychee.animate('#content', 'contentZoomOut');
lychee.animate('.divider', 'fadeOut');
search.hash = data.hash; search.hash = data.hash;
@ -65,7 +64,7 @@ search.find = function(term) {
$('body').append(build.no_content('magnifying-glass')); $('body').append(build.no_content('magnifying-glass'));
} else { } else {
lychee.content.html(html); lychee.content.html(html);
lychee.animate('.album, .photo', 'contentZoomIn'); lychee.animate('#content', 'contentZoomIn');
$('img[data-type!="svg"]').retina(); $('img[data-type!="svg"]').retina();
} }

View File

@ -7,27 +7,13 @@
animation-name: fadeIn; animation-name: fadeIn;
animation-duration: .3s; animation-duration: .3s;
animation-fill-mode: forwards; animation-fill-mode: forwards;
animation-timing-function: $timingBounce; animation-timing-function: $timing;
} }
.fadeOut { .fadeOut {
animation-name: fadeOut; animation-name: fadeOut;
animation-duration: .3s; animation-duration: .3s;
animation-fill-mode: forwards; animation-fill-mode: forwards;
animation-timing-function: $timingBounce;
}
.contentZoomIn {
animation-name: zoomIn;
animation-duration: .2s;
animation-fill-mode: forwards;
animation-timing-function: $timing;
}
.contentZoomOut {
animation-name: zoomOut;
animation-duration: .2s;
animation-fill-mode: forwards;
animation-timing-function: $timing; animation-timing-function: $timing;
} }

View File

@ -20,6 +20,37 @@
&.sidebar { width: calc(100% - 300px); } &.sidebar { width: calc(100% - 300px); }
/* Animations ------------------------------------------------------------------- */
&.contentZoomIn .album,
&.contentZoomIn .photo {
animation-name: zoomIn;
animation-duration: .2s;
animation-fill-mode: forwards;
animation-timing-function: $timing;
}
&.contentZoomIn .divider {
animation-name: fadeIn;
animation-duration: .2s;
animation-fill-mode: forwards;
animation-timing-function: $timing;
}
&.contentZoomOut .album,
&.contentZoomOut .photo {
animation-name: zoomOut;
animation-duration: .2s;
animation-fill-mode: forwards;
animation-timing-function: $timing;
}
&.contentZoomOut .divider {
animation-name: fadeOut;
animation-duration: .3s;
animation-fill-mode: forwards;
animation-timing-function: $timing;
}
/* Albums and Photos ------------------------------------------------*/ /* Albums and Photos ------------------------------------------------*/
.album, .album,
.photo { .photo {

View File

@ -12,7 +12,7 @@
background-color: rgba(25, 25, 25, .98); background-color: rgba(25, 25, 25, .98);
border-left: 1px solid black(.2); border-left: 1px solid black(.2);
transform: translateX(0); transform: translateX(0);
transition: transform .3s $timingBounce; transition: transform .3s $timing;
&.active { transform: translateX(-320px); } &.active { transform: translateX(-320px); }