1
0
Fork 0

construction: Using shorthand and first back outline

This commit is contained in:
joostdecock 2018-07-19 13:14:50 +00:00 committed by Joost De Cock
parent dc8766724e
commit 95ea42916f
10 changed files with 104 additions and 91 deletions

View file

@ -1,9 +1,9 @@
/** Pattern parts */
module.exports = {
parts: [
"backBlock",
"frontBlock",
"_sleeveBlock"
"back",
"front",
"_sleeve"
],
measurements: [
"bicepsCircumference",
@ -37,7 +37,7 @@ module.exports = {
// Percentages
{ "id": "acrossBackFactor", "val": 96, "type": "percentage", "min": 93, "max": 99 },
{ "id": "armholeDepthFactor", "val": 50, "type": "percentage", "min": 50, "max": 65 },
{ "id": "armholeDepthFactor", "val": 50, "type": "percentage", "min": 35, "max": 65 },
{ "id": "sleevecapHeightFactor", "val": 55, "type": "percentage", "min": 35, "max": 75 }
]
};

File diff suppressed because one or more lines are too long

View file

@ -12,21 +12,21 @@
<script>
var pattern = freesewing_patterns_brian;
pattern.settings.measurements = {
bicepsCircumference: 305,
centerBackNeckToWaist: 495,
chestCircumference: 965,
hipsCircumference: 838,
naturalWaistToHip: 110,
neckCircumference: 391,
shoulderSlope: 49,
shoulderToShoulder: 444,
shoulderToWrist: 680,
wristCircumference: 185
bicepsCircumference: 335,
centerBackNeckToWaist: 480,
chestCircumference: 1080,
hipsCircumference: 950,
naturalWaistToHip: 120,
neckCircumference: 420,
shoulderSlope: 55,
shoulderToShoulder: 470,
shoulderToWrist: 700,
wristCircumference: 190
};
//pattern.on('preRenderSvg', function(next) {
// this.style += 'path { fill: red;}';
// next();
//});
pattern.on('preRenderSvg', function(next) {
this.attributes.add("viewBox", "-10 -10 600 800");
next();
});
//pattern.on('preRenderSvg', function(next) {
// this.style += 'path { stroke: green; stroke-width: 30;}';
// next();
@ -46,7 +46,9 @@ pattern.loadPlugin(freesewing_theme_default);
var id = point.id;
var cx = point.getAttribute('x');
var cy = point.getAttribute('y');
console.log('Point '+id+' ( '+cx+' , '+cy+' )');
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;

View file

@ -0,0 +1,27 @@
import F from 'freesewing'
import base from './base';
var back =
{
draft: function(part, context, final = true)
{
let { measurements, options, points, paths, snippets } = F.utils.shorthand(part, context);
base.draft(part, context);
paths.seam = new F.path()
.move(points.cbNeck)
.line(points.cbHips)
.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)
.curve(points.neckCp1, points.cbNeck, points.cbNeck)
.close()
;
}
}
export default back;

View file

@ -0,0 +1,46 @@
import F from 'freesewing'
var base =
{
draft: function(part, context)
{
let { measurements, options, points, paths, snippets } = F.utils.shorthand(part, context);
// Center back (cb) vertical axis
points.cbNeck = new F.point(0, options.backNeckCutout);
points.cbShoulder = new F.point(0, ( measurements.shoulderSlope - options.shoulderSlopeReduction ) / 2);
points.cbArmhole = new F.point(0, points.cbShoulder.y + (measurements.bicepsCircumference + options.bicepsEase) * options.armholeDepthFactor);
points.cbWaist = new F.point(0, measurements.centerBackNeckToWaist + options.backNeckCutout);
points.cbHips = new F.point(0, points.cbWaist.y + measurements.naturalWaistToHip);
// Side back (cb) vertical axis
points.armhole = new F.point(measurements.chestCircumference / 4 + options.chestEase / 4, points.cbArmhole.y);
points.waist = new F.point(points.armhole.x, points.cbWaist.y);
points.hips = new F.point(points.armhole.x, points.cbHips.y);
// Shoulder line
points.neck = new F.point(measurements.neckCircumference / options.collarFactor, 0);
points.shoulder = new F.point(measurements.shoulderToShoulder / 2 + options.shoulderEase / 2, points.cbShoulder.y);
// Armhhole
points.armholePitch = new F.point(measurements.shoulderToShoulder * options.acrossBackFactor / 2, points.shoulder.y + points.shoulder.dy(points.armhole)/2);
points._tmp1 = new F.point(points.armholePitch.x, points.armhole.y);
points._tmp2 = points._tmp1.shift(45, 10);
points._tmp3 = F.utils.beamsCross(points._tmp1, points._tmp2, points.armhole, points.armholePitch);
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
points.armholeCp1 = points.armhole.shift(180, points._tmp1.dx(points.armhole)/4);
points.armholeCp2 = points.armholeHollow.shift(-45, points.armholeHollow.dy(points.armhole)/2);
points.armholeHollowCp1 = points.armholeHollow.shift(135, points.armholePitch.dx(points.armholeHollow));
points.armholeHollowCp2 = points.armholePitch.shift(-90, points.armholePitch.dy(points.armholeHollow)/2);
points.armholePitchCp1 = points.armholePitch.shift(90, points.shoulder.dy(points.armholePitch)/2);
points.armholePitchCp2 = points.shoulder.shiftTowards(points.neck, points.shoulder.dy(points.armholePitch)/5).rotate(90, points.shoulder);
// Neck opening
points._tmp4 = points.neck.shiftTowards(points.shoulder, 10).rotate(-90, points.neck);
points.neckCp1 = F.utils.beamCrossesY(points.neck, points._tmp4, points.cbNeck.y);
points.neckCp2 = points.cbNeck.shift(0, points.cbNeck.dx(points.neck)/2);
}
}
export default base;

View file

@ -1,12 +1,12 @@
import freesewing from 'freesewing'
import F from 'freesewing'
import * as patternConfig from '../config/config'
import { Pattern } from 'freesewing/dist/lib/pattern'
import backBlock from './lib/back'
import back from './back'
var brian = new freesewing.pattern(patternConfig);
var brian = new F.pattern(patternConfig);
brian.draft = function(final = true) {
backBlock.draft(brian, final);
brian.draft = function(final = true)
{
back.draft(brian.parts.back, brian.context, final);
return brian;
}

View file

@ -1,64 +0,0 @@
import freesewing from 'freesewing'
import { Pattern } from 'freesewing/dist/lib/pattern'
var backBlock = {
draft: function(pattern, final = true) {
// Save some typing
let measurements = pattern.settings.measurements || {};
let options = pattern.options;
let values = pattern.values;
let points = pattern.parts.backBlock.points;
let paths = pattern.parts.backBlock.paths;
let snippets = pattern.parts.backBlock.snippets;
let F = freesewing;
// Center back (cb) vertical axis
points.cbNeck = new F.point(0, options.backNeckCutout);
points.cbShoulder = new F.point(0, points.cbNeck.y + ( measurements.shoulderSlope - options.shoulderSlopeReduction ) / 2);
points.cbArmhole = new F.point(0, points.cbShoulder.y + (measurements.bicepsCircumference + options.bicepsEase) * options.armholeDepthFactor);
points.cbWaist = new F.point(0, measurements.centerBackNeckToWaist + options.backNeckCutout);
points.cbHips = new F.point(0, points.cbWaist.y + measurements.naturalWaistToHip);
// Side back (cb) vertical axis
points.armhole = new F.point(measurements.chestCircumference / 4 + options.chestEase / 4, points.cbArmhole.y);
points.waist = new F.point(points.armhole.x, points.cbWaist.y);
points.hips = new F.point(points.armhole.x, points.cbHips.y);
// Shoulder line
points.neck = new F.point(measurements.neckCircumference / options.collarFactor, 0);
points.shoulder = new F.point(measurements.shoulderToShoulder / 2 + options.shoulderEase / 2, points.cbShoulder.y);
// Armhhole
points.armholePitch = new F.point(measurements.shoulderToShoulder * options.acrossBackFactor / 2, points.armhole.y / 2 - points.shoulder.y / 2);
points._tmp1 = new F.point(points.armholePitch.x, points.armhole.y);
points._tmp2 = points._tmp1.shift(45, 10);
points._tmp3 = F.utils.beamsCross(points._tmp1, points._tmp2, points.armhole, points.armholePitch);
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
points.armholeCp1 = points.armhole.shift(180, points._tmp1.dx(points.armhole)/4);
points.armholeCp2 = points.armholeHollow.shift(-45, points.armholeHollow.dy(points.armhole)/2);
points.armholeHollowCp1 = points.armholeHollow.shift(135, points.armholePitch.dx(points.armholeHollow));
points.armholeHollowCp2 = points.armholePitch.shift(-90, points.armholePitch.dy(points.armholeHollow)/2);
points.armholePitchCp1 = points.armholePitch.shift(90, points.shoulder.dy(points.armholePitch)/2);
points.armholePitchCp2 = points.shoulder.shiftTowards(points.neck, 10);
// Dafuq rotate?
console.log(points.shoulder.shiftTowards(points.neck, 10));
console.log(points.shoulder.shiftTowards(points.neck, 10).rotate(points.shoulder, 90));
paths.seam = new F.path()
.move(points.cbShoulder)
.line(points.cbHips)
.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)
.curve(points.neck, points.shoulder, points.armholePitch)
.close()
;
points.gridAnchor = points.cbHips;
}
}
export default backBlock;

View file

@ -0,0 +1 @@
../theme-default/dist/browser/bundle.js

View file

@ -0,0 +1 @@
../theme-designer/dist/browser/bundle.js

View file

@ -1,7 +1,7 @@
const path = require('path');
module.exports = {
mode: 'production',
mode: 'development',
target: 'web',
entry: './src/index.js',
output: {