lib: reorganize file structure
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math' show min, sqrt, pow;
|
import 'dart:math' show min, sqrt, pow;
|
||||||
|
|
||||||
import '../svg/parser.dart';
|
import 'svg/parser.dart';
|
||||||
import '../common/point.dart';
|
import 'point.dart';
|
||||||
|
|
||||||
import 'bezier_cubic.dart' as bezier_cubic;
|
import 'bezier.dart' as bezier;
|
||||||
import 'package:xml/xml.dart';
|
import 'package:xml/xml.dart';
|
||||||
|
|
||||||
double _computePathLength(String path) =>
|
double _computePathLength(String path) =>
|
||||||
@@ -67,13 +67,13 @@ extension Funcs on TimingFunction {
|
|||||||
double Function(double) get func => {
|
double Function(double) get func => {
|
||||||
TimingFunction.linear: (double x) => x,
|
TimingFunction.linear: (double x) => x,
|
||||||
TimingFunction.ease: (double x) =>
|
TimingFunction.ease: (double x) =>
|
||||||
bezier_cubic.value(pt1, easeCt1, easeCt2, pt2, x),
|
bezier.value(pt1, easeCt1, easeCt2, pt2, x),
|
||||||
TimingFunction.easeIn: (double x) =>
|
TimingFunction.easeIn: (double x) =>
|
||||||
bezier_cubic.value(pt1, easeInCt1, easeInCt2, pt2, x),
|
bezier.value(pt1, easeInCt1, easeInCt2, pt2, x),
|
||||||
TimingFunction.easeInOut: (double x) =>
|
TimingFunction.easeInOut: (double x) =>
|
||||||
bezier_cubic.value(pt1, easeInOutCt1, easeInOutCt2, pt2, x),
|
bezier.value(pt1, easeInOutCt1, easeInOutCt2, pt2, x),
|
||||||
TimingFunction.easeOut: (double x) =>
|
TimingFunction.easeOut: (double x) =>
|
||||||
bezier_cubic.value(pt1, easeOutCt1, easeOutCt2, pt2, x),
|
bezier.value(pt1, easeOutCt1, easeOutCt2, pt2, x),
|
||||||
}[this]!;
|
}[this]!;
|
||||||
|
|
||||||
String get name => {
|
String get name => {
|
@@ -1,6 +1,6 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import '../common/point.dart';
|
import 'point.dart';
|
||||||
|
|
||||||
// class Point {
|
// class Point {
|
||||||
// final double x;
|
// final double x;
|
||||||
@@ -17,9 +17,9 @@ double thrt(double x) =>
|
|||||||
|
|
||||||
double sqrt(double x) => x > 0 ? math.sqrt(x) : 0;
|
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
|
/// 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) {
|
double time(Point pt1, Point ct1, Point ct2, Point pt2, double x) {
|
@@ -1,7 +0,0 @@
|
|||||||
library;
|
|
||||||
|
|
||||||
/// A Calculator.
|
|
||||||
class Calculator {
|
|
||||||
/// Returns [value] plus 1.
|
|
||||||
int addOne(int value) => value + 1;
|
|
||||||
}
|
|
@@ -3,7 +3,7 @@
|
|||||||
/// See https://pypi.org/project/svg.path/ for the original implementation.
|
/// See https://pypi.org/project/svg.path/ for the original implementation.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
import '../common/point.dart';
|
import '../point.dart';
|
||||||
import 'path.dart';
|
import 'path.dart';
|
||||||
|
|
||||||
const _commands = {
|
const _commands = {
|
||||||
|
@@ -8,7 +8,7 @@ import 'dart:math' show sqrt, sin, cos, acos, log, pi;
|
|||||||
|
|
||||||
import 'package:bisection/extension.dart';
|
import 'package:bisection/extension.dart';
|
||||||
|
|
||||||
import '../common/point.dart';
|
import '../point.dart';
|
||||||
|
|
||||||
num radians(num n) => n * pi / 180;
|
num radians(num n) => n * pi / 180;
|
||||||
num degrees(num n) => n * 180 / pi;
|
num degrees(num n) => n * 180 / pi;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
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/parser.dart';
|
||||||
import 'package:kanimaji/svg/path.dart';
|
import 'package:kanimaji/svg/path.dart';
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
import 'dart:math' show sqrt, pi;
|
import 'dart:math' show sqrt, pi;
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:kanimaji/common/point.dart';
|
import 'package:kanimaji/point.dart';
|
||||||
import 'package:kanimaji/svg/path.dart';
|
import 'package:kanimaji/svg/path.dart';
|
||||||
|
|
||||||
// from ..path import CubicBezier, QuadraticBezier, Line, Arc, Move, Close, Path
|
// from ..path import CubicBezier, QuadraticBezier, Line, Arc, Move, Close, Path
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// from svg.path import parser
|
// from svg.path import parser
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
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/parser.dart'
|
||||||
show Command, Token, commandifyPath, parsePath, tokenizePath;
|
show Command, Token, commandifyPath, parsePath, tokenizePath;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user