Skip to content

Commit

Permalink
bits
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Oct 30, 2024
1 parent 4b43551 commit 8db4bad
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
9 changes: 8 additions & 1 deletion guhitkudlit2/site/authoring/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ export function Authoring() {
}
.authoringTools {
grid-area: tools;
display: flex;
flex-direction: column;
}
.authoringToolsScroll {
overflow-y: auto;
}
</style>
<div class="authoring authoringLayout">
Expand All @@ -135,7 +140,9 @@ export function Authoring() {
<${Glyphed} />
</main>
<aside class="authoringTools">
<${Toolbar} />
<div class="authoringToolsScroll">
<${Toolbar} />
</div>
</aside>
</div>
`;
Expand Down
11 changes: 11 additions & 0 deletions guhitkudlit2/site/authoring/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ export function Toolbar({
)}
value=${trajectoryParams.lookaheadTime}
/>
<${Input}
type="range"
min="1"
max="4"
step="1"
onChange=${action(
(event) =>
(trajectoryParams.iterations = Number(event.currentTarget.value))
)}
value=${trajectoryParams.iterations}
/>
</div>
`;
}
Expand Down
4 changes: 3 additions & 1 deletion guhitkudlit2/site/calligraphy/generate-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* velErrorWeight: number,
* accelErrorWeight: number,
* lookaheadTime: number,
* iterations: number,
* }} TrajectoryParams
*/

Expand All @@ -24,6 +25,7 @@ export const defaultTrajectoryParams = Object.freeze({
velErrorWeight: 0.9,
accelErrorWeight: 0.9,
lookaheadTime: 30.0,
iterations: 1,
});

/**
Expand Down Expand Up @@ -96,7 +98,7 @@ function* generateStroke(sequence, params) {
function optimizeTrajectory(pen, nodes, nodeTimes, params) {
const tempNode = {};

for (let i = 0; i < 1; i++) {
for (let i = 0; i < Math.min(params.iterations, 10); i++) {
let jerkX = 0;
let jerkY = 0;
let totalWeight = 0;
Expand Down
11 changes: 11 additions & 0 deletions guhitkudlit2/site/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ export function Input({ class: className, tag = "input", ...props }) {
padding: var(--size-xs);
box-sizing: border-box;
}
.formInput[type="range"] {
border: none;
accent-color: var(--color-orange);
background: linear-gradient(
to bottom,
transparent calc(50% - 1px),
var(--color-fg-secondary) calc(50% - 1px),
var(--color-fg-secondary) calc(50% + 1px),
transparent calc(50% + 1px)
);
}
.formInput::placeholder {
opacity: var(--opacity-placeholder);
}
Expand Down
1 change: 1 addition & 0 deletions guhitkudlit2/site/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ body {
font-size: var(--font-size-m);
background: var(--color-bg);
color: var(--color-fg);
accent-color: var(--color-orange);
}

* {
Expand Down

0 comments on commit 8db4bad

Please sign in to comment.