Skip to content

Commit c980a82

Browse files
committed
Attempt at making animations - needs debugging and fixing
1 parent 1c50b9f commit c980a82

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

src/assets/style.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,24 @@ th {
324324
.list-complete-leave-active {
325325
position: absolute;
326326
}
327+
328+
329+
330+
331+
.diff-once-enter-active {
332+
transition: all 10s;
333+
position: absolute;
334+
}
335+
336+
.pos-absolute {
337+
position: absolute;
338+
}
339+
340+
.diff-once-enter {
341+
opacity: 1;
342+
}
343+
344+
.diff-once-enter-to {
345+
opacity: 0;
346+
transform: translateY(-300px);
347+
}

src/components/CardModel.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
<!-- mana cost -->
3232
<div style="float: left; padding-left: 5px;">
3333
<Value :value="card.properties.MANA_COST" type="mana-cost" orElse="0" alwaysShow></Value>
34+
<button @click="testChange()">test</button>
3435
</div>
3536
<div style="float: right; padding-right: 5px;" class="btn-group">
36-
<Value :value="card.properties.ATTACK" type="attack" alwaysShow></Value>
37-
<Value :value="card.properties.HEALTH" type="health" alwaysShow></Value>
37+
<Value :click="[card.properties, 'ATTACK', 10]" :value="card.properties.ATTACK" type="attack" alwaysShow></Value>
38+
<Value :click="[card.properties, 'ATTACK', -10]" :value="card.properties.HEALTH" type="health" alwaysShow></Value>
3839
</div>
3940
</div>
4041
<div style="clear: both;">
@@ -88,6 +89,14 @@ export default {
8889
Value
8990
},
9091
methods: {
92+
testChange() {
93+
this.card.properties.MANA_COST = this.card.properties.MANA_COST + 10;
94+
},
95+
96+
changeProp(map, prop, diff) {
97+
console.log("change map " + prop + " by " + diff);
98+
map[prop] += diff;
99+
},
91100
/**
92101
* Resolves fetching an image file from the file system.
93102
*

src/components/Value.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
<button class="btn btn-sm active fa" :class="`btn-${buttonStyle} fa-${faValue}`" style="cursor:default" :title="title">
44
{{value || orElse}}
55
</button>
6+
<transition-group name="diff-once" class="pos-absolute" tag="div" @after-enter="removeDiff()">
7+
<button v-for="(diff, index) in diffs" :key="index"
8+
class="btn btn-sm active fa diff-once" :class="`btn-${buttonStyle} fa-${faValue}`" style="cursor:default">
9+
{{diff}}
10+
</button>
11+
</transition-group>
612
</div>
713
</template>
814
<script>
@@ -43,10 +49,25 @@ export default {
4349
}
4450
4551
return {
52+
diffs: [],
4653
buttonStyle: style.buttonStyle,
4754
faValue: style.fa,
4855
title: style.title
4956
};
57+
},
58+
methods: {
59+
removeDiff() {
60+
console.log("remove first diff");
61+
this.diffs.splice(0, 1);
62+
}
63+
},
64+
watch: {
65+
value: function(newValue, oldValue) {
66+
console.log("change value from " + oldValue + " to " + newValue);
67+
let diff = newValue - oldValue;
68+
this.diffs.push(diff);
69+
// TweenLite.to(this.$data, 0.5, { tweenedNumber: newValue });
70+
}
5071
}
5172
}
5273

0 commit comments

Comments
 (0)