jQuery-Flight-Indicators
jQuery-Flight-Indicators copied to clipboard
calculation
Excuse me Sir, I want to ask about this. What does these lines mean? How to get calculation for pitch and roll?
Thank you for your attention
// Update at 20Hz var increment = 0; setInterval(function() { // Attitude update attitude.setRoll(30Math.sin(increment/10)); attitude.setPitch(50Math.sin(increment/20));
// Heading update
heading.setHeading(increment);
// Private methods function _setRoll(roll){ placeholder.each(function(){ $(this).find('div.instrument.attitude div.roll').css('transform', 'rotate('+roll+'deg)'); }); }
function _setPitch(pitch){
// alert(pitch);
if(pitch>constants.pitch_bound){pitch = constants.pitch_bound;}
else if(pitch<-constants.pitch_bound){pitch = -constants.pitch_bound;}
placeholder.each(function(){
$(this).find('div.instrument.attitude div.roll div.pitch').css('top', pitch*0.7 + '%');
});
}
function _setHeading(heading){
placeholder.each(function(){
$(this).find('div.instrument.heading div.heading').css('transform', 'rotate(' + -heading + 'deg)');
});
}