at_takuya.sasaki
2014年8月30日 16時00分
Armadillo-840でQMLを使ってテロップ表示をするサンプルコードを書いてみました。 10秒かけて[Hello World]という文字がArmadillo-840のLCDの右から左に流れます。 流れる速さは duration: 10000 のところで変更します。 ついでに文字も毎回色が変わるようにしています。
多少カクカクするかもしれませんが、参考まで。
import QtQuick 2.0
Rectangle {
id: main
width: 800
height: 480
color: "transparent"
Text {
id: telop
x: main.width
y: main.height - 100
text: qsTr("Hello World")
color: "white"
font.pointSize: 50
// Animation start
SequentialAnimation {
running: true
loops: Animation.Infinite
//右から左へ移動
NumberAnimation { target: telop; property: "x"; to: 0 - telop.width; duration: 10000; }
//色を変更する
ScriptAction { script: telop.changeColor() }
}
//ランダムな色に変更
function changeColor(){
color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
}
}
}