topical media & game development

talk show tell print

graphic-javascript-vector-rotation2.js / js



  window.onload = function () {
      // try {
      var text = $("#image p").html();
      $("#image").html("");
      var R = Raphael("image", 800, 800);
      var txt = [];
      var attr = {"font": '50px "Verdana"', opacity: 0.5};
      txt[0] = R.text(300, 300, text).attr(attr).attr("fill", "#0f0");
      txt[1] = R.text(300, 300, text).attr(attr).attr("fill", "#f00");
      txt[2] = R.text(300, 300, text).attr(attr).attr("fill", "#00f");
      var mouse = null, rot = 0;
      document.mousemove(function (e) {
          if (mouse === null) {
              mouse = e.pageX;
              return;
          }
          rot += e.pageX - mouse;
          txt[0].rotate(e.pageX - mouse);
          txt[1].rotate((e.pageX - mouse) * 1.5);
          txt[2].rotate((e.pageX - mouse) * 2);
          mouse = e.pageX;
      });
  // } catch (e) {
  //     alert(e.message);
  // }
  };


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.