LoginSignup
0
0

More than 5 years have passed since last update.

Framer.jsでチャットバブルやinput要素に文字を入れたい時

Posted at

例えば
チャットUIを作っていて、
textInputという入力カーソル用のレイヤーの中にinput要素を突っ込みたい時はこのように書きます

//input要素を作る(この時点ではまだレイヤーには反映されない。)
inputElement = document.createElement("input")

...

inputElement.placeholder = "Type a comment"
inputElement.value = ""
inputElement.focus()
inputElement.onkeyup = (e) ->
    # Draw the message
    if e.keyCode is 13
                          //この中にEnterキーを押した時の挙動を書く

...
//textInputLayerというレイヤーにinput要素を貼り付ける
textInputLayer._element.appendChild(inputElement)


今回モデルにしたプロジェクトはこちら(公式サイトのギャラリーページにあります)

chat bubbles

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0