~mzanetti/+junk/ubuntudefence

« back to all changes in this revision

Viewing changes to qml/AnimatedDelegate.qml

  • Committer: Michael Zanetti
  • Date: 2014-07-15 20:12:01 UTC
  • Revision ID: michael.zanetti@canonical.com-20140715201201-bs1g8lvj2ik0vkwe
allow syncing tower animations to shot timings

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    property string source
8
8
    property int baseSize: -1
9
9
    property int frameCount: -1
 
10
    property int startFrame: -1
10
11
    property real duration: 1000
11
12
    property int spriteSet: -1
12
13
    property bool running: false
13
14
    property bool useEngineClock: true
 
15
    property bool onDemand: false
 
16
 
 
17
    function play() {
 
18
        print("baaaar", root.onDemand)
 
19
        spriteLoader.item.play()
 
20
    }
14
21
 
15
22
    onSourceChanged: loadSprite();
16
23
    onBaseSizeChanged: loadSprite();
17
24
    onFrameCountChanged: loadSprite();
18
25
    onSpriteSetChanged: loadSprite();
 
26
    onStartFrameChanged: loadSprite();
19
27
 
20
28
    function loadSprite() {
21
29
        spriteLoader.source = "";
22
30
 
23
 
        if (!source || baseSize == -1 || frameCount == -1 || spriteSet == -1 ) {
 
31
        if (!source || baseSize == -1 || frameCount == -1 || spriteSet == -1 || startFrame == -1 ) {
24
32
            return;
25
33
        }
26
34
        print("loading sprite", root.source, root)
30
38
                                   source: root.source,
31
39
                                   baseSize: root.baseSize,
32
40
                                   frameCount: root.frameCount,
33
 
                                   spriteSet: root.spriteSet
 
41
                                   spriteSet: root.spriteSet,
 
42
                                   startFrame: root.startFrame
34
43
                               }
35
44
                              );
36
45
    }
57
66
        property: "duration"
58
67
        value: root.duration
59
68
    }
 
69
    Binding {
 
70
        target: spriteLoader.item
 
71
        property: "onDemand"
 
72
        value: root.onDemand
 
73
    }
60
74
}