~gerboland/qtubuntu/devicePixelRatio

« back to all changes in this revision

Viewing changes to tests/MovingLogo.qml

  • Committer: Daniel d'Andrada
  • Date: 2015-08-06 16:36:57 UTC
  • mto: This revision was merged to the branch mainline in revision 278.
  • Revision ID: daniel.dandrada@canonical.com-20150806163657-vos0w93miy9b6a1r
Remove unneeded dependencies from debian/control and ancient manual tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2
 
// Copyright © 2013 Canonical Ltd.
3
 
//
4
 
// This program is free software: you can redistribute it and/or modify it under
5
 
// the terms of the GNU General Public License version 3, as published by the
6
 
// Free Software Foundation.
7
 
//
8
 
// This program is distributed in the hope that it will be useful, but WITHOUT
9
 
// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
 
// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
// General Public License for more details.
12
 
//
13
 
// You should have received a copy of the GNU General Public License along with
14
 
// this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 
16
 
import QtQuick 2.0
17
 
 
18
 
Item {
19
 
    id: surface
20
 
 
21
 
    // Hard-coded Samsung Galaxy Nexus screen size.
22
 
    width: 720
23
 
    height: 1280
24
 
 
25
 
    property real seed
26
 
 
27
 
    function lerp(x, a, b) {
28
 
        return ((1.0 - x) * a) + (x * b);
29
 
    }
30
 
 
31
 
    Item {
32
 
        id: scene
33
 
        anchors.fill: parent
34
 
 
35
 
        Image {
36
 
            id: logo
37
 
            source: "logo.png"
38
 
 
39
 
            SequentialAnimation on y {
40
 
                loops: Animation.Infinite
41
 
                NumberAnimation {
42
 
                    from: 0.0; to: surface.height - logo.height
43
 
                    duration: Math.floor(lerp(Math.random(surface.seed), 2250.0, 2750.0))
44
 
                    easing.type: Easing.InOutSine;
45
 
                }
46
 
                NumberAnimation {
47
 
                    to: 0.0; from: surface.height - logo.height
48
 
                    duration: Math.floor(lerp(Math.random(surface.seed), 2250.0, 2750.0))
49
 
                    easing.type: Easing.InOutSine;
50
 
                }
51
 
            }
52
 
 
53
 
            SequentialAnimation on x {
54
 
                loops: Animation.Infinite
55
 
                NumberAnimation {
56
 
                    from: 0.0; to: surface.width - logo.width
57
 
                    duration: Math.floor(lerp(Math.random(surface.seed), 1750.0, 2250.0))
58
 
                    easing.type: Easing.InOutSine;
59
 
                }
60
 
                NumberAnimation {
61
 
                    to: 0.0; from: surface.width - logo.width
62
 
                    duration: Math.floor(lerp(Math.random(surface.seed), 1750.0, 2250.0))
63
 
                    easing.type: Easing.InOutSine;
64
 
                }
65
 
            }
66
 
        }
67
 
    }
68
 
 
69
 
    Component.onCompleted: {
70
 
        var d = new Date();
71
 
        surface.seed = d.getSeconds();
72
 
    }
73
 
}