@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.22.2
* A FreeSewing pattern for a baby bib that's used in our tutorial
* (c) 2022 Joost De Cock <joost@joost.at> (https://github.com/joostdecock)
* @license MIT
*/
import M from"@freesewing/core";import _ from"@freesewing/plugin-bundle";var u="2.22.2";var L={version:u,name:"tutorial",design:"joostdecock",code:"joostdecock",department:"accessorties",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}}};function T(p){let{Point:e,points:t,Path:r,paths:o,measurements:f,options:g,macro:i,complete:s,snippets:n,Snippet:d,paperless:m}=p.shorthand(),a=1,F=f.head*g.neckRatio/4,l;do t.right=new e(a*f.head/10,0),t.bottom=new e(0,a*f.head/12),t.rightCp1=t.right.shift(90,t.bottom.dy(t.right)/2),t.bottomCp2=t.bottom.shift(0,t.bottom.dx(t.right)/2),o.neck=new r().move(t.right).curve(t.rightCp1,t.bottomCp2,t.bottom),l=o.neck.length()-F,l>0?a=a*.99:a=a*1.02;while(Math.abs(l)>1);t.rightCp2=t.rightCp1.flipY(),t.bottomCp1=t.bottomCp2.flipX(),t.left=t.right.flipX(),t.leftCp1=t.rightCp2.flipX(),t.leftCp2=t.rightCp1.flipX(),t.top=t.bottom.flipY(),t.topCp1=t.bottomCp2.flipY(),t.topCp2=t.bottomCp1.flipY();let R=f.head*g.widthRatio,C=f.head*g.lengthRatio;t.topLeft=new e(R/-2,t.top.y-(R/2-t.right.x)),t.topRight=t.topLeft.shift(0,R),t.bottomLeft=t.topLeft.shift(-90,C),t.bottomRight=t.topRight.shift(-90,C),t.edgeLeft=new e(t.topLeft.x,t.left.y),t.edgeRight=new e(t.topRight.x,t.right.y),t.edgeTop=new e(0,t.topLeft.y),t.edgeLeftCp=t.edgeLeft.shiftFractionTowards(t.topLeft,.5),t.edgeRightCp=t.edgeLeftCp.flipX(),t.edgeTopLeftCp=t.edgeTop.shiftFractionTowards(t.topLeft,.5),t.edgeTopRightCp=t.edgeTopLeftCp.flipX();let c=t.edgeTop.dy(t.top);t.tipRight=t.edgeTop.translate(c/2,c/2),t.tipRightTop=new e(t.tipRight.x,t.edgeTop.y),t.tipRightBottom=new e(t.tipRight.x,t.top.y),i("round",{from:t.edgeTop,to:t.tipRight,via:t.tipRightTop,prefix:"tipRightTop"}),i("round",{from:t.tipRight,to:t.top,via:t.tipRightBottom,prefix:"tipRightBottom"});let Y=["edgeTopLeftCp","edgeTop","tipRight","tipRightTop","tipRightTopStart","tipRightTopCp1","tipRightTopCp2","tipRightTopEnd","tipRightBottomStart","tipRightBottomCp1","tipRightBottomCp2","tipRightBottomEnd","tipRightBottom","top","topCp2"];for(;t.tipRightBottomStart.x>-1;)for(let b of Y)t[b]=t[b].rotate(1,t.edgeLeft);return t.snapLeft=t.top.shiftFractionTowards(t.edgeTop,.5),t.edgeTopRightCp=t.edgeTopLeftCp.flipX(),t.topCp1=t.topCp2.flipX(),t.tipLeftTopStart=t.tipRightTopStart.flipX(),t.tipLeftTopCp1=t.tipRightTopCp1.flipX(),t.tipLeftTopCp2=t.tipRightTopCp2.flipX(),t.tipLeftTopEnd=t.tipRightTopEnd.flipX(),t.tipLeftBottomStart=t.tipRightBottomStart.flipX(),t.tipLeftBottomCp1=t.tipRightBottomCp1.flipX(),t.tipLeftBottomCp2=t.tipRightBottomCp2.flipX(),t.tipLeftBottomEnd=t.tipRightBottomEnd.flipX(),t.snapRight=t.snapLeft.flipX(),i("round",{from:t.topLeft,to:t.bottomRight,via:t.bottomLeft,radius:t.bottomRight.x/4,prefix:"bottomLeft"}),i("round",{from:t.bottomLeft,to:t.topRight,via:t.bottomRight,radius:t.bottomRight.x/4,prefix:"bottomRight"}),o.seam=new r().move(t.edgeLeft).line(t.bottomLeftStart).curve(t.bottomLeftCp1,t.bottomLeftCp2,t.bottomLeftEnd).line(t.bottomRightStart).curve(t.bottomRightCp1,t.bottomRightCp2,t.bottomRightEnd).line(t.edgeRight).curve(t.edgeRightCp,t.edgeTopRightCp,t.tipLeftTopStart).curve(t.tipLeftTopCp1,t.tipLeftTopCp2,t.tipLeftTopEnd).curve(t.tipLeftBottomCp1,t.tipLeftBottomCp2,t.tipLeftBottomEnd).curve(t.topCp1,t.rightCp2,t.right).curve(t.rightCp1,t.bottomCp2,t.bottom).curve(t.bottomCp1,t.leftCp2,t.left).curve(t.leftCp1,t.topCp2,t.tipRightBottomEnd).curve(t.tipRightBottomCp2,t.tipRightBottomCp1,t.tipRightBottomStart).curve(t.tipRightTopCp2,t.tipRightTopCp1,t.tipRightTopStart).curve(t.edgeTopLeftCp,t.edgeLeftCp,t.edgeLeft).close().attr("class","fabric"),s&&(n.snapStud=new d("snap-stud",t.snapLeft),n.snapSocket=new d("snap-socket",t.snapRight).attr("opacity",.5),o.bias=o.seam.offset(-5).attr("class","various dashed").attr("data-text","finishWithBiasTape").attr("data-text-class","center fill-various"),t.title=t.bottom.shift(-90,45),i("title",{at:t.title,nr:1,title:"bib"}),t.scalebox=t.title.shift(-90,55),i("scalebox",{at:t.scalebox}),t.logo=new e(0,0),n.logo=new d("logo",t.logo),m&&(i("hd",{from:t.bottomLeftStart,to:t.bottomRightEnd,y:t.bottomLeft.y+15}),i("vd",{from:t.bottomRightStart,to:t.bottom,x:t.bottomRight.x+15}),i("vd",{from:t.bottomRightStart,to:t.right,x:t.bottomRight.x+30}),i("vd",{from:t.bottomRightStart,to:t.tipLeftTopStart,x:t.bottomRight.x+45}),i("hd",{from:t.left,to:t.right,y:t.left.y+25}),i("ld",{from:t.tipLeftBottomEnd,to:t.tipLeftTopStart,d:-15}))),p}function w(p){let{options:e,Point:t,Path:r,points:o,paths:f,Snippet:g,snippets:i,complete:s,sa:n,paperless:d,macro:m}=p.shorthand(),a=500*e.size;return o.topLeft=new t(0,0),o.topRight=new t(a,0),o.bottomLeft=new t(0,a/2),o.bottomRight=new t(a,a/2),f.seam=new r().move(o.topLeft).line(o.bottomLeft).line(o.bottomRight).line(o.topRight).line(o.topLeft).close().attr("class","fabric"),s&&(o.logo=o.topLeft.shiftFractionTowards(o.bottomRight,.5),i.logo=new g("logo",o.logo),o.text=o.logo.shift(-90,a/8).attr("data-text","hello").attr("data-text-class","center"),n&&(f.sa=f.seam.offset(n).attr("class","fabric sa"))),d&&(m("hd",{from:o.bottomLeft,to:o.bottomRight,y:o.bottomLeft.y+n+15}),m("vd",{from:o.bottomRight,to:o.topRight,x:o.topRight.x+n+15})),p}function v(p){let{Point:e,points:t,Path:r,paths:o,measurements:f}=p.shorthand();return t.right=new e(f.head/10,0),t.bottom=new e(0,f.head/12),t.rightCp1=t.right.shift(90,t.bottom.dy(t.right)/2),t.bottomCp2=t.bottom.shift(0,t.bottom.dx(t.right)/2),o.neck=new r().move(t.right).curve(t.rightCp1,t.bottomCp2,t.bottom),p}function x(p){let{Point:e,points:t,Path:r,paths:o,measurements:f,options:g}=p.shorthand(),i=1,s=f.head*g.neckRatio/4,n;do t.right=new e(i*f.head/10,0),t.bottom=new e(0,i*f.head/12),t.rightCp1=t.right.shift(90,t.bottom.dy(t.right)/2),t.bottomCp2=t.bottom.shift(0,t.bottom.dx(t.right)/2),o.neck=new r().move(t.right).curve(t.rightCp1,t.bottomCp2,t.bottom),n=o.neck.length()-s,n>0?i=i*.99:i=i*1.02;while(Math.abs(n)>1);return p}function S(p){let{points:e,Path:t,paths:r}=p.shorthand();return e.rightCp2=e.rightCp1.flipY(),e.bottomCp1=e.bottomCp2.flipX(),e.left=e.right.flipX(),e.leftCp1=e.rightCp2.flipX(),e.leftCp2=e.rightCp1.flipX(),e.top=e.bottom.flipY(),e.topCp1=e.bottomCp2.flipY(),e.topCp2=e.bottomCp1.flipY(),r.neck=new t().move(e.top).curve(e.topCp2,e.leftCp1,e.left).curve(e.leftCp2,e.bottomCp1,e.bottom).curve(e.bottomCp2,e.rightCp1,e.right).curve(e.rightCp2,e.topCp1,e.top).close(),p}function B(p){let{Point:e,points:t,Path:r,paths:o,measurements:f,options:g}=p.shorthand(),i=f.head*g.widthRatio,s=f.head*g.lengthRatio;return t.topLeft=new e(i/-2,t.top.y-(i/2-t.right.x)),t.topRight=t.topLeft.shift(0,i),t.bottomLeft=t.topLeft.shift(-90,s),t.bottomRight=t.topRight.shift(-90,s),o.rect=new r().move(t.topLeft).line(t.bottomLeft).line(t.bottomRight).line(t.topRight).line(t.topLeft).close(),p}function y(p){let{Point:e,points:t,Path:r,paths:o}=p.shorthand();return t.edgeLeft=new e(t.topLeft.x,t.left.y),t.edgeRight=new e(t.topRight.x,t.right.y),t.edgeTop=new e(0,t.topLeft.y),t.edgeLeftCp=t.edgeLeft.shiftFractionTowards(t.topLeft,.5),t.edgeRightCp=t.edgeLeftCp.flipX(),t.edgeTopLeftCp=t.edgeTop.shiftFractionTowards(t.topLeft,.5),t.edgeTopRightCp=t.edgeTopLeftCp.flipX(),o.rect=new r().move(t.edgeTop).curve(t.edgeTopLeftCp,t.edgeLeftCp,t.edgeLeft).line(t.bottomLeft).line(t.bottomRight).line(t.edgeRight).curve(t.edgeRightCp,t.edgeTopRightCp,t.edgeTop).close(),p}function X(p){let{Point:e,points:t,macro:r}=p.shorthand(),o=t.edgeTop.dy(t.top);return t.tipRight=t.edgeTop.translate(o/2,o/2),t.tipRightTop=new e(t.tipRight.x,t.edgeTop.y),t.tipRightBottom=new e(t.tipRight.x,t.top.y),r("round",{from:t.edgeTop,to:t.tipRight,via:t.tipRightTop,prefix:"tipRightTop",render:!0}),r("round",{from:t.tipRight,to:t.top,via:t.tipRightBottom,prefix:"tipRightBottom",render:!0}),p}function E(p){let{points:e,Path:t,paths:r,macro:o}=p.shorthand(),f=["edgeTopLeftCp","edgeTop","tipRight","tipRightTop","tipRightTopStart","tipRightTopCp1","tipRightTopCp2","tipRightTopEnd","tipRightBottomStart","tipRightBottomCp1","tipRightBottomCp2","tipRightBottomEnd","tipRightBottom","top","topCp2"];for(;e.tipRightBottomStart.x>-1;)for(let g of f)e[g]=e[g].rotate(1,e.edgeLeft);return e.snapLeft=e.top.shiftFractionTowards(e.edgeTop,.5),o("round",{from:e.edgeTop,to:e.tipRight,via:e.tipRightTop,prefix:"tipRightTop",render:!0}),o("round",{from:e.tipRight,to:e.top,via:e.tipRightBottom,prefix:"tipRightBottom",render:!0}),r.rect=new t().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(),p}function k(p){let{points:e,Path:t,paths:r}=p.shorthand();return e.edgeTopRightCp=e.edgeTopLeftCp.flipX(),e.topCp1=e.topCp2.flipX(),e.tipLeftTopStart=e.tipRightTopStart.flipX(),e.tipLeftTopCp1=e.tipRightTopCp1.flipX(),e.tipLeftTopCp2=e.tipRightTopCp2.flipX(),e.tipLeftTopEnd=e.tipRightTopEnd.flipX(),e.tipLeftBottomStart=e.tipRightBottomStart.flipX(),e.tipLeftBottomCp1=e.tipRightBottomCp1.flipX(),e.tipLeftBottomCp2=e.tipRightBottomCp2.flipX(),e.tipLeftBottomEnd=e.tipRightBottomEnd.flipX(),e.snapRight=e.snapLeft.flipX(),r.seam=new t().move(e.edgeLeft).line(e.bottomLeft).line(e.bottomRight).line(e.edgeRight).curve(e.edgeRightCp,e.edgeTopRightCp,e.tipLeftTopStart).curve(e.tipLeftTopCp1,e.tipLeftTopCp2,e.tipLeftTopEnd).curve(e.tipLeftBottomCp1,e.tipLeftBottomCp2,e.tipLeftBottomEnd).curve(e.topCp1,e.rightCp2,e.right).curve(e.rightCp1,e.bottomCp2,e.bottom).curve(e.bottomCp1,e.leftCp2,e.left).curve(e.leftCp1,e.topCp2,e.tipRightBottomEnd).curve(e.tipRightBottomCp2,e.tipRightBottomCp1,e.tipRightBottomStart).curve(e.tipRightTopCp2,e.tipRightTopCp1,e.tipRightTopStart).curve(e.edgeTopLeftCp,e.edgeLeftCp,e.edgeLeft).close().attr("class","fabric"),delete r.neck,delete r.rect,p}function j(p){let{points:e,Path:t,paths:r,macro:o}=p.shorthand();return o("round",{from:e.topLeft,to:e.bottomRight,via:e.bottomLeft,radius:e.bottomRight.x/4,render:!0,prefix:"bottomLeft"}),o("round",{from:e.bottomLeft,to:e.topRight,via:e.bottomRight,radius:e.bottomRight.x/4,render:!0,prefix:"bottomRight"}),r.seam=new t().move(e.edgeLeft).line(e.bottomLeftStart).curve(e.bottomLeftCp1,e.bottomLeftCp2,e.bottomLeftEnd).line(e.bottomRightStart).curve(e.bottomRightCp1,e.bottomRightCp2,e.bottomRightEnd).line(e.edgeRight).curve(e.edgeRightCp,e.edgeTopRightCp,e.tipLeftTopStart).curve(e.tipLeftTopCp1,e.tipLeftTopCp2,e.tipLeftTopEnd).curve(e.tipLeftBottomCp1,e.tipLeftBottomCp2,e.tipLeftBottomEnd).curve(e.topCp1,e.rightCp2,e.right).curve(e.rightCp1,e.bottomCp2,e.bottom).curve(e.bottomCp1,e.leftCp2,e.left).curve(e.leftCp1,e.topCp2,e.tipRightBottomEnd).curve(e.tipRightBottomCp2,e.tipRightBottomCp1,e.tipRightBottomStart).curve(e.tipRightTopCp2,e.tipRightTopCp1,e.tipRightTopStart).curve(e.edgeTopLeftCp,e.edgeLeftCp,e.edgeLeft).close(),p}function P(p){let{Point:e,points:t,paths:r,macro:o,complete:f,snippets:g,Snippet:i}=p.shorthand();return f&&(g.snapStud=new i("snap-stud",t.snapLeft),g.snapSocket=new i("snap-socket",t.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"),t.title=t.bottom.shift(-90,45),o("title",{at:t.title,nr:1,title:"bib"}),t.scalebox=t.title.shift(-90,55),o("scalebox",{at:t.scalebox}),t.logo=new e(0,0),g.logo=new i("logo",t.logo)),p}var h=new M.Design(L,_);h.prototype.draftBib=T;h.prototype.draftStep1=w;h.prototype.draftStep2=v;h.prototype.draftStep3=x;h.prototype.draftStep4=S;h.prototype.draftStep5=B;h.prototype.draftStep6=y;h.prototype.draftStep7=X;h.prototype.draftStep8=E;h.prototype.draftStep9=k;h.prototype.draftStep10=j;h.prototype.draftStep11=P;var lt=h;export{h as Tutorial,L as config,lt as default};
//# sourceMappingURL=index.mjs.map