javascript - GSAP unexpected rotation result -
i have dial works expected when dragged should rotate selected year when clicked. when behaves erratically. have posted this codepen better illustrate problem.
i consoled log index of clicked element make sure right element has been clicked. colored black on hover. once dial loaded first click return right data , rotate dial expected position. next click won't won't output expected message (clicked index) on console.
it looks problem on rotation tweenlite line tweenmax.to($("#dial_square"), 0.7, { rotation:theta });
on giradial() function. if comment out line on giradial() function click triggers function , console outputs expected values obviously, without dial rotation.
function giradial(lapos){ var theta = -1-lapos*36; $('.anual').removeclass('activo'); var girar; $('.diametral').each(function( indx, elmt ){ girar = indx*-36 - theta; //tweenlite.to($(this).find('.anual'), 0.8, { rotation:girar }); }); //tweenlite.to($("#dial_square"), 0.8, { rotation:theta }); tweenlite.to($(".anual"), 1.8, { opacity:0.8 }); $anuales[lapos].addclass('activo'); return theta; }
i've been struggling couple of days , can't find solution or similar problem.
the final work can seen here too: http://report2016.barentsre.com/ (navigate timeline section).
Comments
Post a Comment