-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.vue
56 lines (52 loc) · 1.31 KB
/
hello.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<template>
<div v-bind:style="style" class="hello">
{{ text }}
</div>
</template>
<style lang="less" scoped>
.hello {
position: absolute;
top: 100px;
left: 200px;
background-color: var(--background);
color: var(--foreground);
padding: 10px;
font-family: sans-serif;
font-size: 22pt;
}
</style>
<script>
export default {
name: "hello",
props: {
background: { type: String, default: "#f0f0f0" },
foreground: { type: String, default: "#666666" },
text: { type: String, default: "Hello World" }
},
computed: {
style: HUDS.vueprop2cssvar()
},
created () {
Mousetrap.bind("space", (e) => {
huds.send("hello.bounce")
})
huds.bind("hello.bounce", (event, data) => {
this.bounce()
})
},
methods: {
bounce () {
anime.timeline({
targets: this.$el,
duration: 400,
autoplay: true,
direction: "normal",
loop: 3,
easing: "easeInOutSine"
})
.add({ scaleX: 2.00, scaleY: 2.00 })
.add({ scaleX: 1.00, scaleY: 1.00 })
}
}
}
</script>