1
0
Fork 0

tada: Initial commit

This commit is contained in:
Joost De Cock 2018-08-11 16:42:35 +02:00
parent 6597d8218d
commit aebcf8e3ad
24 changed files with 7743 additions and 3 deletions

3
packages/aaron/.babelrc Normal file
View file

@ -0,0 +1,3 @@
{
"plugins": ["transform-object-rest-spread"]
}

View file

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

62
packages/aaron/.gitignore vendored Normal file
View file

@ -0,0 +1,62 @@
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next

View file

@ -0,0 +1,2 @@
src
.editorconfig

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 freesewing
Copyright (c) 2018 Joost De Cock
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,2 +1,15 @@
# aaron
A freesewing tank top or A-shirt pattern
<p align="center">
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
</p>
<h4 align="center"><em>&nbsp;<a title="Go to freesewing.org" href="https://freesewing.org/">freesewing</a></em>
<br><sup>a library for made-to-measure sewing patterns</sup>
</h4>
# freesewing / patterns / brian
Brian is a [freesewing](https://github.com/freesewing/freesewing) pattern
for a basic body block for menswear. It's the basis for many of our menswear patterns.
## Example
FIXME: Include example

1
packages/aaron/brian.js Symbolic link
View file

@ -0,0 +1 @@
../brian/dist/browser.js

View file

@ -0,0 +1,37 @@
export default {
name: "aaron",
measurements: [
"bicepsCircumference",
"centerBackNeckToWaist",
"chestCircumference",
"naturalWaistToHip",
"neckCircumference",
"shoulderSlope",
"shoulderToShoulder",
"hipsCircumference"
],
options: {
// Constants
collarFactor: 4.8,
acrossBackFactor: 0.97,
backNeckCutout: 0.05,
bicepsEase: 0.05,
shoulderEase: 0,
collarEase: 0,
frontArmholeDeeper: 0,
armholeDepthFactor: 0.6,
// Percentages
armholeDrop: { val: 10, min: 0, max: 50 },
backlineBend: { val: 0, min: 0, max: 8 },
chestEase: { val: 8, min: 0, max: 20 },
hipsEase: { val: 8, min: 0, max: 20 },
lengthBonus: { val: 10, min:-20, max: 60 },
necklineBend: { val: 60, min: 40, max: 100 },
necklineDrop: { val: 15, min: 10, max: 35 },
shoulderSlopeReduction: { val: 0, min: 0, max: 8 },
stretchFactor: { val: 5, min: 0, max: 15 },
shoulderStrapWidth: { val: 20, min: 10, max: 40 },
shoulderStrapPlacement: { val: 50, min: 20, max: 80 },
}
};

View file

@ -0,0 +1 @@
../freesewing/dist/browser.js

63
packages/aaron/index.html Normal file
View file

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Aaron</title>
</head>
<body>
<div id="svg"></div>
<script src="freesewing.js"></script>
<script src="https://unpkg.com/@freesewing/plugin-bundle"></script>
<script src="brian.js"></script>
<script src="dist/browser.js"></script>
<script src="tmp/theme.js"></script>
<script src="tmp/designer.js"></script>
<script src="tmp/models.js"></script>
<script src="tmp/antmantest.js"></script>
<script src="tmp/validate.js"></script>
<script src="tmp/debug.js"></script>
<script>
var pattern = freesewing.patterns.aaron
.with(freesewing.plugins.validate)
.with(freesewing.plugins.debug)
.with(freesewing.plugins.theme)
.with(freesewing.plugins.designer)
console.log('freesewing', freesewing);
//pattern.settings.paperless = true;
pattern.settings.measurements = freesewing.models.men.manSize36;
pattern.settings.sa = 10;
pattern.settings.units = 'metric';
pattern.settings.sample = {
type: 'measurement',
measurement: 'shoulderToShoulder'
}
//pattern.sampleOption('lengthBonus');
//pattern.sampleMeasurement('bicepsCircumference');
//pattern.sampleModels(freesewing.antmantest);
pattern.draft();
document.getElementById("svg").innerHTML = pattern.render();
function pointHover(evt) {
var point = evt.target;
var id = point.id;
var cx = point.getAttribute('x');
var cy = point.getAttribute('y');
var name = point.getAttribute('data-point');
var part = point.getAttribute('data-part');
console.log(name+' ('+cx+', '+cy+') @ '+part);
var scale = 2;
cx = cx-scale*cx;
cy = cy-scale*cy;
point.setAttribute("transform", 'matrix('+scale+', 0, 0, '+scale+', '+cx+', '+cy+')');
pointUnhover(id);
}
function pointUnhover(id) {
setTimeout(function(){
document.getElementById(id).removeAttribute("transform", '');
}, 500);
}
</script>
</body>
</html>

7114
packages/aaron/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,81 @@
{
"version": "0.6.4",
"name": "@freesewing/aaron",
"description": "Freesewing pattern for a A-shirt / tank top",
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
"license": "MIT",
"homepage": "https://github.com/freesewing/aaronr#readme",
"repository": "github:freesewing/aaron",
"bugs": {
"url": "https://github.com/freesewing/aaron/issues"
},
"keywords": [
"freesewing",
"pattern",
"sewing",
"menswear",
"block"
],
"main": "dist/index.js",
"module": "dist/index.mjs",
"unpkg": "dist/browser.js",
"scripts": {
"precommit": "npm run pretty && lint-staged",
"patch": "npm version patch -m ':bookmark: v%s' && npm run build",
"minor": "npm version minor -m ':bookmark: v%s' && npm run build",
"major": "npm version major -m ':bookmark: v%s' && npm run build",
"test": "echo \"Error: no test specified\" && exit 1",
"clean": "rimraf dist",
"pretty": "npx prettier --write \"src/*.js\"",
"lint": "eslint --fix \"src/*.js\"",
"watch": "npx webpack --watch",
"browserbuild": "rollup -c rollup.js -o dist/browser.js -f iife -n freesewing_patterns_aaron --footer 'freesewing.patterns.aaron = freesewing_patterns_aaron;'",
"nodebuild": "rollup -c rollup.js -o dist/index.js -f cjs",
"modulebuild": "rollup -c rollup.js -o dist/index.mjs -f es",
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,json}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"@freesewing/brian": "0.6.6",
"@freesewing/plugin-bundle": "0.0.1",
"freesewing": "^0.6.2"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.56",
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.56",
"@babel/preset-env": "7.0.0-beta.56",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-loader": "^8.0.0-beta.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"eslint": "5.3.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.2",
"husky": "^0.14.3",
"lint-staged": "^7.2.0",
"prettier": "1.14.0",
"rimraf": "^2.6.2",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "9.1.3",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1"
},
"files": [
"dist/*",
"README.md",
"package-lock.json",
"package.json"
]
}

38
packages/aaron/rollup.js Normal file
View file

@ -0,0 +1,38 @@
import { terser } from "rollup-plugin-terser";
import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import json from "rollup-plugin-json";
import path from "path";
import { name, version, description, author, license } from "./package.json";
export default {
input: "src/index.js",
plugins: [
resolve({
browser: true
}),
json(),
commonjs(),
babel({
exclude: "node_modules/**"
})
//terser({
// output: {
// preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
// }
//})
],
external: [
"freesewing",
"@freesewing/plugin-bundle",
"@freesewing/brian"
],
output: {
globals: {
freesewing: "freesewing",
"@freesewing/plugin-bundle": "freesewing.plugins.bundle",
"@freesewing/brian": "freesewing.patterns.brian",
}
}
};

View file

@ -0,0 +1,61 @@
import freesewing from "freesewing";
import * as shared from "./shared";
var back = {
draft: function(part) {
// prettier-ignore
let {store, sa, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
// Seamline
paths.seam = shared.seamLine("back", points, Path);
// Store lengths to fit sleeve
store.set("backArmholeLength", shared.armholeLength(points, Path));
store.set(
"backShoulderToArmholePitch",
shared.shoulderToArmholePitch(points, Path)
);
// Final?
if (final) {
macro("cutonfold", {
from: points.cbNeck,
to: points.cbHips,
grainline: true
});
macro("title", { at: points.title, nr: 2, title: "back" });
snippets.armholePitchNotch = new Snippet("bnotch", points.armholePitch);
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
shared.dimensions(macro, points, Path, sa);
macro("hd", {
from: points.cbHips,
to: points.hips,
y: points.hips.y + sa + 15
});
macro("vd", {
from: points.cbHips,
to: points.cbNeck,
x: points.cbHips.x - sa - 15
});
macro("hd", {
from: points.cbNeck,
to: points.neck,
y: points.neck.y - sa - 15
});
macro("hd", {
from: points.cbNeck,
to: points.shoulder,
y: points.neck.y - sa - 30
});
}
return part;
}
};
export default back;

114
packages/aaron/src/front.js Normal file
View file

@ -0,0 +1,114 @@
//import * as shared from "./shared";
var front = {
draft: function(part) {
// prettier-ignore
let {utils, store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = part.shorthand();
// Handle stretch
for(let i in points) points[i].x = points[i].x * (1 - options.stretchFactor);
// Rename cb (center back) to cf (center front)
for (let key of ["Neck", "Shoulder", "Armhole", "Waist", "Hips"]) {
points[`cf${key}`] = new Point(
points[`cb${key}`].x,
points[`cb${key}`].y
);
delete points[`cb${key}`];
}
// Neckline
points.cfNeck = points.cfNeck.shift(-90, options.necklineDrop *
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip)
);
// Strap
points.strapCenter = points.neck.shiftFractionTowards(points.shoulder, options.shoulderStrapPlacement);
points.strapLeft = points.strapCenter.shiftTowards(points.neck, points.neck.dist(points.shoulder) * options.shoulderStrapWidth);
points.strapRight = points.strapLeft.rotate(180, points.strapCenter);
points.necklineCorner = utils.beamsCross(
points.strapLeft,
points.strapRight.rotate(-90, points.strapLeft),
points.cfNeck.shift(0, points.armholePitch.x/4),
points.cfNeck
);
points.strapLeftCp2 = points.strapLeft.shiftFractionTowards(points.necklineCorner, options.necklineBend);
points.cfNeckCp1 = points.cfNeck.shiftFractionTowards(points.necklineCorner, options.necklineBend);
// Hips
points.hips.x = (measurements.hipsCircumference + (options.hipsEase * measurements.hipsCircumference))/4 * (1 - options.stretchFactor);
points.waist.x = points.hips.x; // Because stretch
points.waistCp2 = points.waist.shift(90,points.armhole.dy(points.waist)/2);
// Armhole
points.armholeCorner = utils.beamsCross(
points.armhole,
points.armholeCp2,
points.strapRight,
points.strapLeft.rotate(90, points.strapRight)
);
points.armholeCp2 = points.armhole.shiftFractionTowards(points.armholeCorner, 0.8);
points.strapRightCp1 = points.strapRight.shiftFractionTowards(points.armholeCorner, 0.6);
// Armhole drop
console.log('cfneck', points.cfNeck);
console.log(measurements.naturalWaistToHip);
console.log(measurements.centerBackNeckToWaist);
// Seamline
paths.seam = new Path()
.move(points.cfNeck)
.line(points.cfHips)
.line(points.hips)
.line(points.waist)
.curve(points.waistCp2, points.armhole, points.armhole)
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
.line(points.strapLeft)
.curve(points.strapLeftCp2, points.cfNeckCp1, points.cfNeck)
.close()
.attr("class", "fabric");
/*
// Final?
if (final) {
macro("cutonfold", {
from: points.cfNeck,
to: points.cfHips,
grainline: true
});
macro("title", { at: points.title, nr: 1, title: "front" });
snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
shared.dimensions(macro, points, Path, sa);
macro("hd", {
from: points.cfHips,
to: points.hips,
y: points.hips.y + sa + 15
});
macro("vd", {
from: points.cfHips,
to: points.cfNeck,
x: points.cfHips.x - sa - 15
});
macro("hd", {
from: points.cfNeck,
to: points.neck,
y: points.neck.y - sa - 15
});
macro("hd", {
from: points.cfNeck,
to: points.shoulder,
y: points.neck.y - sa - 30
});
}
*/
return part;
}
};
export default front;

View file

@ -0,0 +1,26 @@
import freesewing from "freesewing";
import brian from "@freesewing/brian";
import pluginBundle from "@freesewing/plugin-bundle";
import config from "../config/config";
import { version } from "../package.json";
import back from "./back";
import front from "./front";
var pattern = new freesewing.Pattern({ version: version, ...config })
.with(pluginBundle);
pattern.draft = function() {
this.parts.base = this.draftBase(new pattern.Part());
this.parts.front = this.draftFront(new pattern.Part().copy(this.parts.base));
//this.parts.back = this.draftBack(this);
return pattern;
};
pattern.draftBase = part => freesewing.patterns.brian.draftBase(part);
pattern.draftFront = part => front.draft(part);
pattern.draftBack = part => back.draft(part);
export default pattern;

View file

@ -0,0 +1,91 @@
export function seamLine(side, points, Path) {
let path = new Path();
if (side === "back") {
path.move(points.cbNeck);
path.line(points.cbHips);
} else {
path.move(points.cfNeck);
path.line(points.cfHips);
}
path
.line(points.hips)
.line(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
.line(points.neck);
if (side === "back") {
path.curve(points.neckCp1, points.cbNeck, points.cbNeck);
} else {
path.curve(points.neckCp1, points.neckCp2, points.cfNeck);
}
path.close().attr("class", "fabric");
return path;
}
export function armholeLength(points, Path) {
return new Path()
.move(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
.length();
}
export function shoulderToArmholePitch(points, Path) {
return new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
.length();
}
export function dimensions(macro, points, Path, sa) {
macro("pd", {
path: new Path()
.move(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
.curve(
points.armholeHollowCp1,
points.armholeHollowCp2,
points.armholePitch
)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder),
d: sa + 15
});
macro("pd", {
path: new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder),
d: -15
});
macro("vd", {
from: points.hips,
to: points.armhole,
x: points.hips.x + sa + 15
});
macro("vd", {
from: points.hips,
to: points.armholePitch,
x: points.hips.x + sa + 30
});
macro("vd", {
from: points.hips,
to: points.shoulder,
x: points.hips.x + sa + 45
});
macro("vd", {
from: points.hips,
to: points.neck,
x: points.hips.x + sa + 60
});
macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 });
}

14
packages/aaron/test.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Brian</title>
</head>
<body>
<div id="svg"></div>
<script type="text/javascript" src="freesewing.js"></script>
<script>
console.log(freesewing);
</script>
</body>
</html>

View file

@ -0,0 +1 @@
../../antmantest/dist/browser.js

1
packages/aaron/tmp/debug.js Symbolic link
View file

@ -0,0 +1 @@
../../plugins/plugin-debug/dist/browser.js

View file

@ -0,0 +1 @@
../../plugins/plugin-designer/dist/browser.js

View file

@ -0,0 +1 @@
../../models/dist/browser.js

1
packages/aaron/tmp/theme.js Symbolic link
View file

@ -0,0 +1 @@
../../plugins/plugin-theme/dist/browser.js

View file

@ -0,0 +1 @@
../../plugins/plugin-validate/dist/browser.js