Skip to content

Commit ccb7c53

Browse files
committed
mark behaviors that could be configurable
1 parent 6b9fff0 commit ccb7c53

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

internal/animate/interpolate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {Shape} from "../types";
22
import {split, splitLine, mod} from "../util";
33

4-
// TODO percentage > 1
4+
// TODO allow percentage > 1
5+
// OPT? loop
56

67
const interpolateAngle = (percentage: number, a: number, b: number): number => {
78
const tau = Math.PI * 2;

internal/animate/prepare.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "../util";
1212
import {Point, Shape} from "../types";
1313

14+
// OPT extract optimization logic
1415
const optimizeOrder = (a: Shape, b: Shape): Shape => {
1516
const count = a.length;
1617

@@ -38,6 +39,7 @@ const optimizeOrder = (a: Shape, b: Shape): Shape => {
3839
return shift(minOffset, minShape);
3940
};
4041

42+
// OPT allow extra division
4143
export const divideShape = (count: number, points: Shape): Shape => {
4244
if (points.length < 3) throw new Error("not enough points");
4345
if (count < points.length) throw new Error("cannot remove points");
@@ -62,6 +64,7 @@ export const divideShape = (count: number, points: Shape): Shape => {
6264
return out;
6365
};
6466

67+
// OPT disable
6568
const fixAnglesWith = (fixee: Shape, fixer: Shape): Shape => {
6669
const out: Shape = [];
6770
for (let i = 0; i < fixee.length; i++) {
@@ -79,6 +82,7 @@ const fixAnglesWith = (fixee: Shape, fixer: Shape): Shape => {
7982
return out;
8083
};
8184

85+
// OPT disable
8286
const fixAnglesSelf = (shape: Shape): Shape => {
8387
const out: Shape = [];
8488
for (let i = 0; i < shape.length; i++) {

internal/render/canvas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const drawPoint = (ctx: CanvasRenderingContext2D, p: Coord, style: string) => {
3131
ctx.fillStyle = backupFillStyle;
3232
};
3333

34+
// OPT draw cutout
3435
export const drawShape = (ctx: CanvasRenderingContext2D, debug: boolean, shape: Shape) => {
3536
if (shape.length < 2) throw new Error("not enough points");
3637

internal/render/svg.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export interface RenderOptions {
2424
boundingBox?: boolean;
2525
}
2626

27+
// OPT render path only
28+
2729
// Renders a shape made up of the input points to an editable data structure
2830
// which can be rendered to svg.
2931
export const renderEditable = (points: Shape, opt: RenderOptions): XmlElement => {

internal/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Handle {
1111
length: number;
1212
}
1313

14+
// TODO? use four coord instead of angles
1415
export interface Point extends Coord {
1516
// Cubic bezier handles.
1617
handleIn: Handle;

0 commit comments

Comments
 (0)