lib: reorganize file structure

This commit is contained in:
2025-08-04 21:38:39 +02:00
parent c83821fa38
commit 0623bbc50a
10 changed files with 15 additions and 22 deletions

View File

@@ -1,10 +1,10 @@
import 'dart:io';
import 'dart:math' show min, sqrt, pow;
import '../svg/parser.dart';
import '../common/point.dart';
import 'svg/parser.dart';
import 'point.dart';
import 'bezier_cubic.dart' as bezier_cubic;
import 'bezier.dart' as bezier;
import 'package:xml/xml.dart';
double _computePathLength(String path) =>
@@ -67,13 +67,13 @@ extension Funcs on TimingFunction {
double Function(double) get func => {
TimingFunction.linear: (double x) => x,
TimingFunction.ease: (double x) =>
bezier_cubic.value(pt1, easeCt1, easeCt2, pt2, x),
bezier.value(pt1, easeCt1, easeCt2, pt2, x),
TimingFunction.easeIn: (double x) =>
bezier_cubic.value(pt1, easeInCt1, easeInCt2, pt2, x),
bezier.value(pt1, easeInCt1, easeInCt2, pt2, x),
TimingFunction.easeInOut: (double x) =>
bezier_cubic.value(pt1, easeInOutCt1, easeInOutCt2, pt2, x),
bezier.value(pt1, easeInOutCt1, easeInOutCt2, pt2, x),
TimingFunction.easeOut: (double x) =>
bezier_cubic.value(pt1, easeOutCt1, easeOutCt2, pt2, x),
bezier.value(pt1, easeOutCt1, easeOutCt2, pt2, x),
}[this]!;
String get name => {

View File

@@ -1,6 +1,6 @@
import 'dart:math' as math;
import '../common/point.dart';
import 'point.dart';
// class Point {
// final double x;
@@ -17,9 +17,9 @@ double thrt(double x) =>
double sqrt(double x) => x > 0 ? math.sqrt(x) : 0;
double sq(x) => x * x;
num sq(num x) => x * x;
double cb(x) => x * x * x;
num cb(num x) => x * x * x;
/// x(t) = t^3 T + 3t^2(1-t) U + 3t(1-t)^2 V + (1-t)^3 W
double time(Point pt1, Point ct1, Point ct2, Point pt2, double x) {

View File

@@ -1,7 +0,0 @@
library;
/// A Calculator.
class Calculator {
/// Returns [value] plus 1.
int addOne(int value) => value + 1;
}

View File

@@ -3,7 +3,7 @@
/// See https://pypi.org/project/svg.path/ for the original implementation.
library;
import '../common/point.dart';
import '../point.dart';
import 'path.dart';
const _commands = {

View File

@@ -8,7 +8,7 @@ import 'dart:math' show sqrt, sin, cos, acos, log, pi;
import 'package:bisection/extension.dart';
import '../common/point.dart';
import '../point.dart';
num radians(num n) => n * pi / 180;
num degrees(num n) => n * 180 / pi;

View File

@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:kanimaji/common/point.dart';
import 'package:kanimaji/point.dart';
import 'package:kanimaji/svg/parser.dart';
import 'package:kanimaji/svg/path.dart';

View File

@@ -2,7 +2,7 @@
import 'dart:math' show sqrt, pi;
import 'package:flutter_test/flutter_test.dart';
import 'package:kanimaji/common/point.dart';
import 'package:kanimaji/point.dart';
import 'package:kanimaji/svg/path.dart';
// from ..path import CubicBezier, QuadraticBezier, Line, Arc, Move, Close, Path

View File

@@ -2,7 +2,7 @@
// from svg.path import parser
import 'package:flutter_test/flutter_test.dart';
import 'package:kanimaji/common/point.dart';
import 'package:kanimaji/point.dart';
import 'package:kanimaji/svg/parser.dart'
show Command, Token, commandifyPath, parsePath, tokenizePath;