1
0
Fork 0

Minor pattern tutorial edits

This commit is contained in:
Natalia Sayang 2024-03-20 00:49:55 +00:00
parent a98b869175
commit 05ad74490e
6 changed files with 32 additions and 66 deletions

View file

@ -142,15 +142,6 @@ function draftBib({
points.bottomLeft = points.topLeft.shift(-90, length)
points.bottomRight = points.topRight.shift(-90, length)
paths.rect = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.addClass('fabric')
/*
* Shape the straps
*/
@ -203,11 +194,8 @@ function draftBib({
}
}
// highlight-end
/*
* Always draw your path at the end
* after you've manipulated your points
*/
/*
* Now, adapt our `rect` path so it's no longer a rectangle:
*/
paths.rect = new Path()
@ -227,7 +215,7 @@ function draftBib({
Once we have our list of points to rotate, we can rotate them. How far? Until the strap no longer overlaps.
<Example tutorial caption="It is looking pretty wonky now, but we'll deal with that next">
```src/bib.mjs
```design/src/bib.mjs
function draftBib({
Path,
Point,
@ -312,15 +300,6 @@ function draftBib({
points.bottomLeft = points.topLeft.shift(-90, length)
points.bottomRight = points.topRight.shift(-90, length)
paths.rect = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.addClass('fabric')
/*
* Shape the straps
*/
@ -372,6 +351,7 @@ function draftBib({
}
}
// highlight-start
/*
* This is the list of points we need to rotate
* to move our strap out of the way
@ -427,15 +407,10 @@ function draftBib({
hide: false,
classes: 'contrast dotted',
})
// highlight-end
/*
* Always draw your path at the end
* after you've manipulated your points
*/
/*
* Now, adapt our `rect` path so it's no longer a rectangle:
*/
paths.rect = new Path()
.move(points.edgeTop)
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
@ -444,7 +419,6 @@ function draftBib({
.line(points.edgeRight)
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
.close()
// highlight-end
return part
}

View file

@ -115,15 +115,6 @@ function draftBib({
points.bottomLeft = points.topLeft.shift(-90, length)
points.bottomRight = points.topRight.shift(-90, length)
paths.rect = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.addClass('fabric')
/*
* Shape the straps
*/
@ -139,18 +130,6 @@ function draftBib({
)
points.edgeTopRightCp = points.edgeTopLeftCp.flipX()
/*
* Now, adapt our `rect` path so it's no longer a rectangle:
*/
paths.rect = new Path()
.move(points.edgeTop)
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.edgeRight)
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
.close()
// highlight-start
// Round the straps
const strap = points.edgeTop.dy(points.top)
@ -174,7 +153,22 @@ function draftBib({
hide: false
})
// highlight-end
/*
* Now, adapt our `rect` path so it's no longer a rectangle:
*/
paths.rect = new Path()
.move(points.edgeTop)
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.edgeRight)
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
.close()
return part
}
```
</Example>
Notice that we always draw our path at the end after we've manipulated our points.

View file

@ -63,10 +63,12 @@ Change the function to look like this:
```design/src/bib.mjs
function draftBib({
// highlight-start
Path,
Point,
paths,
points,
// highlight-end
part,
}) {

View file

@ -104,19 +104,6 @@ function draftBib({
points.bottomLeft = points.topLeft.shift(-90, length)
points.bottomRight = points.topRight.shift(-90, length)
// strikeout-start
/* Remove this path
paths.rect = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.addClass('fabric')
*/
// strikeout-end
/*
* Shape the straps
*/
@ -180,6 +167,11 @@ function draftBib({
}
}
/*
* This is the list of points we need to rotate
* to move our strap out of the way
*/
const rotateThese = [
"edgeTopLeftCp",
"edgeTop",

View file

@ -8,8 +8,6 @@ We already know how to round corners, we'll have the `round` macro take care of
With our corners rounded, we should also update our path.
Fortunately, we merely have to update the start of it.
We'll rename `paths.rect` to `paths.seam`.
<Example tutorial caption="The shape of our bib is now completed">
```design/src/bib.mjs
function draftBib({

View file

@ -102,6 +102,10 @@ function draftBib({
points.bottomLeft = points.topLeft.shift(-90, length)
points.bottomRight = points.topRight.shift(-90, length)
// strikeout-start
/*
* Remove this path
paths.rect = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
@ -110,6 +114,8 @@ function draftBib({
.line(points.topLeft)
.close()
.addClass('fabric')
*/
// strikeout-end
// highlight-start
/*