View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#9
Right, okay, after a bit of mucking about and reading up on animations and transitions, I got a result.

My aim was to have a greeting show at specific time intervals, in this case, 'morning', 'noon', 'evening' and 'night, as in 'Good Evening'. I didn't want the greeting to display all the time, so i needed a way to bind the greeting with a timer/transition/animation/combination.....here's what I came up with eventually;

Code:
    Text {
        id: greetingText
                font { pixelSize: Theme.fontSizeMedium; capitalization: Font.Capitalize }
        anchors {
            bottom: parent.bottom
            bottomMargin: Theme.paddingMedium
            horizontalCenter: parent.horizontalCenter
        }
        text: { updatesEnabled: timeText.time
            var greetingText;
            var time = new Date().getHours();
            if (time >= 0 && time < 12){
                greetingText = "good <b>morning</b>";
            } else if (time >= 12 && time < 16){
                greetingText = "good <b>afternoon</b>";
            } else if (time >= 16 && time < 21){
                greetingText = "good <b>evening</b>";
            } else if (time >= 21 && time < 24){
                greetingText = "good <b>night</b>";
            }
        }
        SequentialAnimation on color {
            id: fadeGreetingTextInOut
            running: greetingText.text
            ColorAnimation { from: "#00000000"; to: "#FFFFFFFF"; duration: 15000; easing.type: Easing.InLinear }
            PauseAnimation { duration: 10000 }
            ColorAnimation { from: "#FFFFFFFF"; to: "#00000000"; duration: 15000; easing.type: Easing.OutLinear }
        }
    }
I'll leave it here for those who are remotely interested!
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 4 Users Say Thank You to Markkyboy For This Useful Post: