Skip to content

Commit 47a4fad

Browse files
committed
[update] mouse input and add the animation to the triangle colors.
1 parent b60009a commit 47a4fad

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tools/triangles_demo/src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ impl Component for TrianglesComponent {
7373

7474
let triangle_data = &[
7575
PushConstant {
76-
color: [1.0, 1.0, 0.0, 1.0],
76+
color: [
77+
1.0,
78+
1.0 * self.animation_scalar,
79+
0.5 * self.animation_scalar,
80+
1.0,
81+
],
7782
pos: [x, y],
7883
scale: [0.3, 0.3],
7984
},
@@ -161,10 +166,10 @@ impl Component for TrianglesComponent {
161166
virtual_key,
162167
} => match virtual_key {
163168
Some(VirtualKey::W) => {
164-
self.position.1 += 0.01;
169+
self.position.1 -= 0.01;
165170
}
166171
Some(VirtualKey::S) => {
167-
self.position.1 -= 0.01;
172+
self.position.1 += 0.01;
168173
}
169174
Some(VirtualKey::A) => {
170175
self.position.0 -= 0.01;

0 commit comments

Comments
 (0)