How to show the wind direction on a compass

I am working on a web application where it should show temperature, humidity, wind speed, wind direction, etc. I use google.visualization.Gauge () to show other things, but I want to show the wind direction to the compass. Does anyone know of any (jQuery / javascript / etc) compass that I can use for the website / webapp? Thanks

+5
source share
2 answers

Here my approach uses only CSS. Used to turn the needle. DEMO You can also use the jQuery Rotate plugin .

HTML

<div id="compass">
  <div id="arrow"></div>
</div>

CSS

#compass {
  width: 380px;
  height: 380px;
  background-image:url('http://i.imgur.com/44nyA.jpg');
  position: relative;
}
#arrow {
  width: 360px;
  height: 20px;
  background-color:#F00;
  position: absolute;
  top: 180px;
  left: 10px;
  -webkit-transform:rotate(120deg);
  -moz-transform:rotate(120deg);
  -o-transform:rotate(120deg);
  -ms-transform:rotate(120deg);

  -moz-transition: all 1s ease;
  -webkit-transition: all 1s ease;
  -o-transition: all 1s ease;
  transition: all 1s ease;
}

#compass:hover #arrow {
  -webkit-transform:rotate(0deg);
  -moz-transform:rotate(0deg);
  -o-transform:rotate(0deg);
  -ms-transform:rotate(0deg);
}​
+5
source

HTML5, and Canvas will do a short job.

http://www.tutorialspoint.com/html5/canvas_drawing_lines.htm

, javascript.

+1

All Articles