@freesewing/tutorial
Version:
A FreeSewing pattern for a baby bib that's used in our tutorial
9 lines (8 loc) • 12.3 kB
JavaScript
/**
* @freesewing/tutorial | v2.11.2
* A FreeSewing pattern for a baby bib that's used in our tutorial
* (c) 2021 Joost De Cock <joost@decock.org> (https://github.com/joostdecock)
* @license MIT
*/
"use strict";var t=require("@freesewing/core"),o=require("@freesewing/plugin-bundle");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var p=e(t),i=e(o),r={name:"tutorial",version:"2.11.2",design:"joostdecock",code:"joostdecock",department:"womenswear",type:"pattern",difficulty:1,tags:["example"],optionGroups:{fit:["neckRatio","widthRatio","lengthRatio"],box:["size"]},measurements:["head"],inject:{step4:"step3",step5:"step4",step6:"step5",step7:"step6",step8:"step7",step9:"step8",step10:"step9",step11:"step10"},parts:["step1","step2","bib"],options:{size:{pct:50,min:10,max:100},neckRatio:{pct:80,min:70,max:90},widthRatio:{pct:45,min:35,max:55},lengthRatio:{pct:75,min:55,max:85}}};const h=new p.default.Design(r,i.default);h.prototype.draftBib=function(t){let o,{Point:e,points:p,Path:i,paths:r,measurements:h,options:g,macro:f,complete:a,snippets:n,Snippet:m,paperless:d}=t.shorthand(),s=1,l=h.head*g.neckRatio/4;do{p.right=new e(s*h.head/10,0),p.bottom=new e(0,s*h.head/12),p.rightCp1=p.right.shift(90,p.bottom.dy(p.right)/2),p.bottomCp2=p.bottom.shift(0,p.bottom.dx(p.right)/2),r.neck=(new i).move(p.right).curve(p.rightCp1,p.bottomCp2,p.bottom),o=r.neck.length()-l,s*=o>0?.99:1.02}while(Math.abs(o)>1);p.rightCp2=p.rightCp1.flipY(),p.bottomCp1=p.bottomCp2.flipX(),p.left=p.right.flipX(),p.leftCp1=p.rightCp2.flipX(),p.leftCp2=p.rightCp1.flipX(),p.top=p.bottom.flipY(),p.topCp1=p.bottomCp2.flipY(),p.topCp2=p.bottomCp1.flipY();let R=h.head*g.widthRatio,C=h.head*g.lengthRatio;p.topLeft=new e(R/-2,p.top.y-(R/2-p.right.x)),p.topRight=p.topLeft.shift(0,R),p.bottomLeft=p.topLeft.shift(-90,C),p.bottomRight=p.topRight.shift(-90,C),p.edgeLeft=new e(p.topLeft.x,p.left.y),p.edgeRight=new e(p.topRight.x,p.right.y),p.edgeTop=new e(0,p.topLeft.y),p.edgeLeftCp=p.edgeLeft.shiftFractionTowards(p.topLeft,.5),p.edgeRightCp=p.edgeLeftCp.flipX(),p.edgeTopLeftCp=p.edgeTop.shiftFractionTowards(p.topLeft,.5),p.edgeTopRightCp=p.edgeTopLeftCp.flipX();let c=p.edgeTop.dy(p.top);p.tipRight=p.edgeTop.translate(c/2,c/2),p.tipRightTop=new e(p.tipRight.x,p.edgeTop.y),p.tipRightBottom=new e(p.tipRight.x,p.top.y),f("round",{from:p.edgeTop,to:p.tipRight,via:p.tipRightTop,prefix:"tipRightTop"}),f("round",{from:p.tipRight,to:p.top,via:p.tipRightBottom,prefix:"tipRightBottom"});let b=["edgeTopLeftCp","edgeTop","tipRight","tipRightTop","tipRightTopStart","tipRightTopCp1","tipRightTopCp2","tipRightTopEnd","tipRightBottomStart","tipRightBottomCp1","tipRightBottomCp2","tipRightBottomEnd","tipRightBottom","top","topCp2"];for(;p.tipRightBottomStart.x>-1;)for(let t of b)p[t]=p[t].rotate(1,p.edgeLeft);return p.snapLeft=p.top.shiftFractionTowards(p.edgeTop,.5),p.edgeTopRightCp=p.edgeTopLeftCp.flipX(),p.topCp1=p.topCp2.flipX(),p.tipLeftTopStart=p.tipRightTopStart.flipX(),p.tipLeftTopCp1=p.tipRightTopCp1.flipX(),p.tipLeftTopCp2=p.tipRightTopCp2.flipX(),p.tipLeftTopEnd=p.tipRightTopEnd.flipX(),p.tipLeftBottomStart=p.tipRightBottomStart.flipX(),p.tipLeftBottomCp1=p.tipRightBottomCp1.flipX(),p.tipLeftBottomCp2=p.tipRightBottomCp2.flipX(),p.tipLeftBottomEnd=p.tipRightBottomEnd.flipX(),p.snapRight=p.snapLeft.flipX(),f("round",{from:p.topLeft,to:p.bottomRight,via:p.bottomLeft,radius:p.bottomRight.x/4,prefix:"bottomLeft"}),f("round",{from:p.bottomLeft,to:p.topRight,via:p.bottomRight,radius:p.bottomRight.x/4,prefix:"bottomRight"}),r.seam=(new i).move(p.edgeLeft).line(p.bottomLeftStart).curve(p.bottomLeftCp1,p.bottomLeftCp2,p.bottomLeftEnd).line(p.bottomRightStart).curve(p.bottomRightCp1,p.bottomRightCp2,p.bottomRightEnd).line(p.edgeRight).curve(p.edgeRightCp,p.edgeTopRightCp,p.tipLeftTopStart).curve(p.tipLeftTopCp1,p.tipLeftTopCp2,p.tipLeftTopEnd).curve(p.tipLeftBottomCp1,p.tipLeftBottomCp2,p.tipLeftBottomEnd).curve(p.topCp1,p.rightCp2,p.right).curve(p.rightCp1,p.bottomCp2,p.bottom).curve(p.bottomCp1,p.leftCp2,p.left).curve(p.leftCp1,p.topCp2,p.tipRightBottomEnd).curve(p.tipRightBottomCp2,p.tipRightBottomCp1,p.tipRightBottomStart).curve(p.tipRightTopCp2,p.tipRightTopCp1,p.tipRightTopStart).curve(p.edgeTopLeftCp,p.edgeLeftCp,p.edgeLeft).close().attr("class","fabric"),a&&(n.snapMale=new m("snap-male",p.snapLeft),n.snapFemale=new m("snap-female",p.snapRight).attr("opacity",.5),r.bias=r.seam.offset(-5).attr("class","various dashed").attr("data-text","finishWithBiasTape").attr("data-text-class","center fill-various"),p.title=p.bottom.shift(-90,45),f("title",{at:p.title,nr:1,title:"bib"}),p.scalebox=p.title.shift(-90,55),f("scalebox",{at:p.scalebox}),p.logo=new e(0,0),n.logo=new m("logo",p.logo),d&&(f("hd",{from:p.bottomLeftStart,to:p.bottomRightEnd,y:p.bottomLeft.y+15}),f("vd",{from:p.bottomRightStart,to:p.bottom,x:p.bottomRight.x+15}),f("vd",{from:p.bottomRightStart,to:p.right,x:p.bottomRight.x+30}),f("vd",{from:p.bottomRightStart,to:p.tipLeftTopStart,x:p.bottomRight.x+45}),f("hd",{from:p.left,to:p.right,y:p.left.y+25}),f("ld",{from:p.tipLeftBottomEnd,to:p.tipLeftTopStart,d:-15}))),t},h.prototype.draftStep1=function(t){let{options:o,Point:e,Path:p,points:i,paths:r,Snippet:h,snippets:g,complete:f,sa:a,paperless:n,macro:m}=t.shorthand(),d=500*o.size;return i.topLeft=new e(0,0),i.topRight=new e(d,0),i.bottomLeft=new e(0,d/2),i.bottomRight=new e(d,d/2),r.seam=(new p).move(i.topLeft).line(i.bottomLeft).line(i.bottomRight).line(i.topRight).line(i.topLeft).close().attr("class","fabric"),f&&(i.logo=i.topLeft.shiftFractionTowards(i.bottomRight,.5),g.logo=new h("logo",i.logo),i.text=i.logo.shift(-90,d/8).attr("data-text","hello").attr("data-text-class","center"),a&&(r.sa=r.seam.offset(a).attr("class","fabric sa"))),n&&(m("hd",{from:i.bottomLeft,to:i.bottomRight,y:i.bottomLeft.y+a+15}),m("vd",{from:i.bottomRight,to:i.topRight,x:i.topRight.x+a+15})),t},h.prototype.draftStep2=function(t){let{Point:o,points:e,Path:p,paths:i,measurements:r}=t.shorthand();return e.right=new o(r.head/10,0),e.bottom=new o(0,r.head/12),e.rightCp1=e.right.shift(90,e.bottom.dy(e.right)/2),e.bottomCp2=e.bottom.shift(0,e.bottom.dx(e.right)/2),i.neck=(new p).move(e.right).curve(e.rightCp1,e.bottomCp2,e.bottom),t},h.prototype.draftStep3=function(t){let o,{Point:e,points:p,Path:i,paths:r,measurements:h,options:g}=t.shorthand(),f=1,a=h.head*g.neckRatio/4;do{p.right=new e(f*h.head/10,0),p.bottom=new e(0,f*h.head/12),p.rightCp1=p.right.shift(90,p.bottom.dy(p.right)/2),p.bottomCp2=p.bottom.shift(0,p.bottom.dx(p.right)/2),r.neck=(new i).move(p.right).curve(p.rightCp1,p.bottomCp2,p.bottom),o=r.neck.length()-a,f*=o>0?.99:1.02}while(Math.abs(o)>1);return t},h.prototype.draftStep4=function(t){let{points:o,Path:e,paths:p}=t.shorthand();return o.rightCp2=o.rightCp1.flipY(),o.bottomCp1=o.bottomCp2.flipX(),o.left=o.right.flipX(),o.leftCp1=o.rightCp2.flipX(),o.leftCp2=o.rightCp1.flipX(),o.top=o.bottom.flipY(),o.topCp1=o.bottomCp2.flipY(),o.topCp2=o.bottomCp1.flipY(),p.neck=(new e).move(o.top).curve(o.topCp2,o.leftCp1,o.left).curve(o.leftCp2,o.bottomCp1,o.bottom).curve(o.bottomCp2,o.rightCp1,o.right).curve(o.rightCp2,o.topCp1,o.top).close(),t},h.prototype.draftStep5=function(t){let{Point:o,points:e,Path:p,paths:i,measurements:r,options:h}=t.shorthand(),g=r.head*h.widthRatio,f=r.head*h.lengthRatio;return e.topLeft=new o(g/-2,e.top.y-(g/2-e.right.x)),e.topRight=e.topLeft.shift(0,g),e.bottomLeft=e.topLeft.shift(-90,f),e.bottomRight=e.topRight.shift(-90,f),i.rect=(new p).move(e.topLeft).line(e.bottomLeft).line(e.bottomRight).line(e.topRight).line(e.topLeft).close(),t},h.prototype.draftStep6=function(t){let{Point:o,points:e,Path:p,paths:i}=t.shorthand();return e.edgeLeft=new o(e.topLeft.x,e.left.y),e.edgeRight=new o(e.topRight.x,e.right.y),e.edgeTop=new o(0,e.topLeft.y),e.edgeLeftCp=e.edgeLeft.shiftFractionTowards(e.topLeft,.5),e.edgeRightCp=e.edgeLeftCp.flipX(),e.edgeTopLeftCp=e.edgeTop.shiftFractionTowards(e.topLeft,.5),e.edgeTopRightCp=e.edgeTopLeftCp.flipX(),i.rect=(new p).move(e.edgeTop).curve(e.edgeTopLeftCp,e.edgeLeftCp,e.edgeLeft).line(e.bottomLeft).line(e.bottomRight).line(e.edgeRight).curve(e.edgeRightCp,e.edgeTopRightCp,e.edgeTop).close(),t},h.prototype.draftStep7=function(t){let{Point:o,points:e,macro:p}=t.shorthand(),i=e.edgeTop.dy(e.top);return e.tipRight=e.edgeTop.translate(i/2,i/2),e.tipRightTop=new o(e.tipRight.x,e.edgeTop.y),e.tipRightBottom=new o(e.tipRight.x,e.top.y),p("round",{from:e.edgeTop,to:e.tipRight,via:e.tipRightTop,prefix:"tipRightTop",render:!0}),p("round",{from:e.tipRight,to:e.top,via:e.tipRightBottom,prefix:"tipRightBottom",render:!0}),t},h.prototype.draftStep8=function(t){let{points:o,Path:e,paths:p,macro:i}=t.shorthand(),r=["edgeTopLeftCp","edgeTop","tipRight","tipRightTop","tipRightTopStart","tipRightTopCp1","tipRightTopCp2","tipRightTopEnd","tipRightBottomStart","tipRightBottomCp1","tipRightBottomCp2","tipRightBottomEnd","tipRightBottom","top","topCp2"];for(;o.tipRightBottomStart.x>-1;)for(let t of r)o[t]=o[t].rotate(1,o.edgeLeft);return o.snapLeft=o.top.shiftFractionTowards(o.edgeTop,.5),i("round",{from:o.edgeTop,to:o.tipRight,via:o.tipRightTop,prefix:"tipRightTop",render:!0}),i("round",{from:o.tipRight,to:o.top,via:o.tipRightBottom,prefix:"tipRightBottom",render:!0}),p.rect=(new e).move(o.edgeTop).curve(o.edgeTopLeftCp,o.edgeLeftCp,o.edgeLeft).line(o.bottomLeft).line(o.bottomRight).line(o.edgeRight).curve(o.edgeRightCp,o.edgeTopRightCp,o.edgeTop).close(),t},h.prototype.draftStep9=function(t){let{points:o,Path:e,paths:p}=t.shorthand();return o.edgeTopRightCp=o.edgeTopLeftCp.flipX(),o.topCp1=o.topCp2.flipX(),o.tipLeftTopStart=o.tipRightTopStart.flipX(),o.tipLeftTopCp1=o.tipRightTopCp1.flipX(),o.tipLeftTopCp2=o.tipRightTopCp2.flipX(),o.tipLeftTopEnd=o.tipRightTopEnd.flipX(),o.tipLeftBottomStart=o.tipRightBottomStart.flipX(),o.tipLeftBottomCp1=o.tipRightBottomCp1.flipX(),o.tipLeftBottomCp2=o.tipRightBottomCp2.flipX(),o.tipLeftBottomEnd=o.tipRightBottomEnd.flipX(),o.snapRight=o.snapLeft.flipX(),p.seam=(new e).move(o.edgeLeft).line(o.bottomLeft).line(o.bottomRight).line(o.edgeRight).curve(o.edgeRightCp,o.edgeTopRightCp,o.tipLeftTopStart).curve(o.tipLeftTopCp1,o.tipLeftTopCp2,o.tipLeftTopEnd).curve(o.tipLeftBottomCp1,o.tipLeftBottomCp2,o.tipLeftBottomEnd).curve(o.topCp1,o.rightCp2,o.right).curve(o.rightCp1,o.bottomCp2,o.bottom).curve(o.bottomCp1,o.leftCp2,o.left).curve(o.leftCp1,o.topCp2,o.tipRightBottomEnd).curve(o.tipRightBottomCp2,o.tipRightBottomCp1,o.tipRightBottomStart).curve(o.tipRightTopCp2,o.tipRightTopCp1,o.tipRightTopStart).curve(o.edgeTopLeftCp,o.edgeLeftCp,o.edgeLeft).close().attr("class","fabric"),delete p.neck,delete p.rect,t},h.prototype.draftStep10=function(t){let{points:o,Path:e,paths:p,macro:i}=t.shorthand();return i("round",{from:o.topLeft,to:o.bottomRight,via:o.bottomLeft,radius:o.bottomRight.x/4,render:!0,prefix:"bottomLeft"}),i("round",{from:o.bottomLeft,to:o.topRight,via:o.bottomRight,radius:o.bottomRight.x/4,render:!0,prefix:"bottomRight"}),p.seam=(new e).move(o.edgeLeft).line(o.bottomLeftStart).curve(o.bottomLeftCp1,o.bottomLeftCp2,o.bottomLeftEnd).line(o.bottomRightStart).curve(o.bottomRightCp1,o.bottomRightCp2,o.bottomRightEnd).line(o.edgeRight).curve(o.edgeRightCp,o.edgeTopRightCp,o.tipLeftTopStart).curve(o.tipLeftTopCp1,o.tipLeftTopCp2,o.tipLeftTopEnd).curve(o.tipLeftBottomCp1,o.tipLeftBottomCp2,o.tipLeftBottomEnd).curve(o.topCp1,o.rightCp2,o.right).curve(o.rightCp1,o.bottomCp2,o.bottom).curve(o.bottomCp1,o.leftCp2,o.left).curve(o.leftCp1,o.topCp2,o.tipRightBottomEnd).curve(o.tipRightBottomCp2,o.tipRightBottomCp1,o.tipRightBottomStart).curve(o.tipRightTopCp2,o.tipRightTopCp1,o.tipRightTopStart).curve(o.edgeTopLeftCp,o.edgeLeftCp,o.edgeLeft).close(),t},h.prototype.draftStep11=function(t){let{Point:o,points:e,paths:p,macro:i,complete:r,snippets:h,Snippet:g}=t.shorthand();return r&&(h.snapMale=new g("snap-male",e.snapLeft),h.snapFemale=new g("snap-female",e.snapRight).attr("opacity",.5),p.bias=p.seam.offset(-5).attr("class","various dashed").attr("data-text","finishWithBiasTape").attr("data-text-class","center fill-various"),e.title=e.bottom.shift(-90,45),i("title",{at:e.title,nr:1,title:"bib"}),e.scalebox=e.title.shift(-90,55),i("scalebox",{at:e.scalebox}),e.logo=new o(0,0),h.logo=new g("logo",e.logo)),t},module.exports=h;
//# sourceMappingURL=index.js.map