サークルがしばらくの間拡大しているサークルアニメーションがあります。 https://rimildeyjsr.github.io/spotify-circle-animation/サークルアニメーションを最適化する
アニメーションが長時間実行されると、文字通りフレームのドロップが表示され、スクロールするアニメーション(fullPage.jsを使用)が画面全体で遅れることがあります。アニメーションを最適化するために
、私は次のことを試してみています
- それはそのアニメーションの終わりに到達したときのページから、円のdivを削除する - これはあまりにも多くを助けていないようですので、次のページにスクロールすると、ピクセル化で拡大している最初の円がまだ見えます。
制限
divs
のサイズ - Iは、円の 膨張を遅らせる100%、上scale(50.0,50.0)
にscale(100.0,100.0)
からアニメーション を変更しようとしています。私は1000px
から500px
に初期サイズを変更しようとしましたが、これもまた円の拡大を遅らせます。これらのソリューションはどちらも最適化には影響しません。アニメーションはウェブサイトの速度を低下させます。スタートし、各セクションにスクロール上のアニメーションを停止 - 私は これは
afterLoad
とonLeave
コールバックを使用して可能であるfullPage.jsを使用しておりますので。アニメーションを止める方法がわからないだけの問題です。
は、ここに私のコードです:
CSS:
html,body{
padding: 0;
margin: 0;
height: 100%;
width: 100%;
overflow-y: hidden;
overflow-x: hidden;
background-color: #24ccdf;
}
.initial-div {
width: 1000px;
height: 1000px;
transform: scale(0);
}
.position-div{
position: absolute;
border-radius: 50%;
display: none;
}
.animate {
-webkit-animation: expand 2500s;
}
@-webkit-keyframes expand {
0%{
-webkit-transform: scale(0,0);
}
100%{
-webkit-transform: scale(100.0,100.0);
display: none;
}
}
のjQuery:
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
function makeDiv(color){
var divsize = 1000;
//$('body').css({'background-color':bgColor});
$newdiv = $('<div/>').addClass('initial-div').css({
'background-color': color
});
var posx = (Math.random() * ($('.section').width()) - (divsize/2)).toFixed();
var posy = (Math.random() * ($('.section').height()) - (divsize/2)).toFixed();
$newdiv.addClass('position-div').css({
'left':posx+'px',
'top':posy+'px'
}).appendTo("#fullpage").addClass('animate').css({'display':'block'}).one(animationEnd,function(){
$(this).remove();
});
}
$(document).ready(function(){
$('#fullpage').fullpage({
anchors: ['home','about','projects','blog','contact'],
fixedElements: '#toggle,#overlay',
afterLoad : function(anchorLink,index) {
if(index == 1 || anchorLink == 'home'){
circleAnimation();
}
else if(index == 2 || anchorLink == 'about'){
$('#section2 h1').addClass('come-in').one(animationEnd,function(){
$('#section2 h3').addClass('come-in').one(animationEnd,function(){
$('#section2 p').addClass('come-in');
});
});
}
}
});
function circleAnimation(){
var colorArray = ['#11256c','#24ccdf'];
var i= 0,flag=0;
var color = colorArray[i];
setInterval(function(){
flag++;
makeDiv(color);
if (flag == 15){
color = colorArray[i];
i++;
if (i == 2) {
i = 0;
}
flag=0;
}
},2000);
}
});
すべてのヘルプ、ヒントやポインタは心から感謝しています。前もって感謝します!
あまりにも多くの編集をおこなって申し訳ありません。減速を遅らせる方法があれば、その時間プロパティの代わりに、2500年代は拡張を遅くするだけです。私はそれを受け入れる準備ができています。また、サークルはランダムな位置から開始する必要があります。私はあなたが言及したように醜いエッジにつながっている画面を超えて拡大したくありません。私の唯一の期待は、サークルが開始および拡大されることです。スクリーンの半分をカバーすると、色が反転し、アニメーションがやり直されます。 –
私はアニメーションから私が望むものを明確に伝えたいと思っています。 –
設定で少し再生することができます。恐らく40年代の拡大は既に十分です。 – Gerard