0. GUIからScriptsへの書き換え

lab.js Builderでは,GUIからScriptsへの置き換えは画面単位で行うことが出来ます。慣れてきたらScriptsに書き換えておくと

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5c071cee-3b9f-4a2e-98a0-eca2490daeff/Untitled.png

1.画像をScriptsで読み込む

完成した2AFC課題の「Stimuli」コンポーネントの「Content」を選択してください。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b274707d-c535-4fa7-954b-03d9ef899acd/Untitled.png

2つの画像を削除してください。「Content」の内容を「Scripts」内にコードで書きます。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5d3b1410-654a-4804-98e3-ef23ae4f2c15/Untitled.png

「Scripts」タブを選択してください。コードの実行タイミングは「event」から「before:prepare」に変えてください。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/734d9a60-887f-4297-a9a2-9371379df0ca/Untitled.png

以下のコードを書き込んでください。詳しくは「逆引きプログラム例」の基本図形1「content」を見てください。Imageをコンポーネントに追加します。

逆引きプログラム例

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5f249c86-d8ad-4b68-9f02-ef557be95626/Untitled.png

GUIにplaceholderを追加するのとそれほど難しさに違いはないのではないでしょうか。

// Image
  this.options.content.push({
    // set left
    type: 'image', 
    left: -200,top: 0, 
    width:200, height:200,
    src: '${ this.files[parameters.setleft] }'
  })
  this.options.content.push({
    // set right
    type: 'image', 
    left: 200,top: 0, 
    width:200, height:200,
    src: '${ this.files[parameters.setright] }'
  })

以下は完成版のファイルです。