Letter Shadows from User Input

后端 未结 2 1083
春和景丽
春和景丽 2021-01-29 11:01

Goal: User types name into user input field, selects Animate button, and name is printed vertically with each letter containing a drop shadow of each letter. The Javascript li

2条回答
  •  误落风尘
    2021-01-29 11:32

    Here is also the text output function with Raphael:

    function draw_text() {
      var txt = document.getElementById("words").value;
      var posy = txt.length*10;
      r.clear();
      var attr = {font: "50px Helvetica", opacity: 0.5};
      var text = r.text(40, 40+posy, txt).attr(attr).attr({fill: "#0f0"}); // underlayer or "shadow"
      text.attr({transform: "r270"}); // rotate 270 degrees
      var text2 = r.text(43, 43+posy, txt).attr(attr).attr({fill: "#aa0"}); // text above
      text2.attr({transform: "r270"}); // rotate 270 degrees
      r.safari();
    }
    
    var r = new Raphael("draw-here-raphael");
    

    The full script, based on this example, is here.

提交回复
热议问题