feat(docs/hold-tap): Begin implementing tap-preferred animations
This commit is contained in:
parent
c80960e3bf
commit
578543b02b
6 changed files with 77 additions and 0 deletions
|
@ -40,6 +40,7 @@ values={[
|
|||
{label: 'Hold-Preferred', value: 'hold-preferred'},
|
||||
{label: 'Balanced', value: 'balanced'},
|
||||
{label: 'Tap-Preferred', value: 'tap-preferred'},
|
||||
{label: 'Tap-Unless-Interrupted', value: 'tap-unless-interrupted'},
|
||||
]}>
|
||||
|
||||
<TabItem value="hold-preferred">
|
||||
|
@ -70,6 +71,14 @@ On the other hand, if the interrupting key is released before the hold-tap, the
|
|||
|
||||
<TabItem value="tap-preferred">
|
||||
|
||||
|
||||
|
||||
<AnimationPlayer auto small name="tap_preferred_hold_tap_up" />
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="tap-unless-interrupted">
|
||||
|
||||

|
||||
|
||||
</TabItem>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"version": 0
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
import { makeProject } from "@motion-canvas/core/lib";
|
||||
|
||||
import tap_preferred_hold_tap_up from "../scenes/hold_tap/tap_preferred_hold_tap_up?scene";
|
||||
|
||||
export default makeProject({
|
||||
scenes: [tap_preferred_hold_tap_up],
|
||||
background: "#FFFFFF",
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"version": 0
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
import { makeScene2D } from "@motion-canvas/2d/lib/scenes";
|
||||
import { makeRefs } from "@motion-canvas/core/lib/utils";
|
||||
import { any, all, chain, delay, waitFor } from "@motion-canvas/core/lib/flow";
|
||||
import Key, { KeyTravel } from "../../components/Key";
|
||||
import Output from "../../components/Output";
|
||||
import { linear } from "@motion-canvas/core/lib/tweening";
|
||||
|
||||
export default makeScene2D(function* (view) {
|
||||
const interrupt = makeRefs<typeof Key>();
|
||||
view.add(<Key refs={interrupt} binding={"&kp"} params={"J"} />);
|
||||
interrupt.group.position.x(125);
|
||||
interrupt.group.position.y(-150);
|
||||
interrupt.duration.fill("#D9D9D9");
|
||||
|
||||
const hold = makeRefs<typeof Key>();
|
||||
view.add(<Key refs={hold} binding={"&ht_tp"} params={"\u21e7 F"} />);
|
||||
hold.group.position.x(-125);
|
||||
hold.group.position.y(-150);
|
||||
hold.duration.fill("#D9D9D9");
|
||||
|
||||
const hold_output = makeRefs<typeof Output>();
|
||||
view.add(<Output refs={hold_output} />);
|
||||
hold_output.group.position(hold.group.position().addX(125));
|
||||
hold_output.group.position.y(hold_output.group.position.y() + 300);
|
||||
|
||||
yield* waitFor(0.5);
|
||||
yield* any(
|
||||
hold.body.position.y(KeyTravel, 0.15),
|
||||
hold.duration.grow(0.5, 1, linear)
|
||||
);
|
||||
yield* delay(
|
||||
0.35,
|
||||
all(
|
||||
interrupt.body.position.y(KeyTravel, 0.15),
|
||||
hold.duration.fill("F21D00", 0.15)
|
||||
)
|
||||
);
|
||||
yield* delay(
|
||||
0.35,
|
||||
chain(
|
||||
hold.body.position.y(0, 0.15),
|
||||
hold.group.rotation(3, 0.03),
|
||||
hold.group.rotation(-3, 0.06),
|
||||
hold.group.rotation(0, 0.03),
|
||||
hold.duration.grow(0, 0.15),
|
||||
delay(0.05, hold_output.output.text("f", 0)),
|
||||
delay(0.05, hold_output.output.text("fj", 0))
|
||||
)
|
||||
);
|
||||
yield* waitFor(0.25);
|
||||
yield* interrupt.body.position.y(0, 0.15);
|
||||
yield* waitFor(1);
|
||||
});
|
|
@ -9,6 +9,7 @@ export default defineConfig({
|
|||
"./src/hold_tap/hold_tap_interrupted.ts",
|
||||
"./src/hold_tap/balanced_other_key_up.ts",
|
||||
"./src/hold_tap/balanced_hold_tap_up.ts",
|
||||
"./src/hold_tap/tap_preferred_hold_tap_up.ts",
|
||||
],
|
||||
}),
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue