1
0
Fork 0

chore(markdown): Working on v3 docs

This commit is contained in:
Joost De Cock 2022-09-20 18:09:28 +02:00
parent 22680fbddc
commit 1f7ba79f81
17 changed files with 433 additions and 272 deletions

View file

@ -2,15 +2,19 @@
title: Pattern.sampleOption()
---
A pattern's `sampleOption()` method will _sample_ a given option,
which means to draft it in different iterations while adjusting the input value
of the given option.
The practical implementation varies based on [the type of option](/config/options/):
The `Pattern.sampleOption()` method will _sample_ the pattern which means
to draft multiple variants of the same pattern, and stack them on
top of each other.
In this particular case, the variants it drafts depend
on [the type of option](/config/options/):
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
- For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
- For options with a **list** of options, each option in the list will be sampled
<Fixme>Handle other option types</Fixme>
<Tip>
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
its min and max boundaries are correct and its default value is sensible.
@ -18,17 +22,6 @@ its min and max boundaries are correct and its default value is sensible.
<Note>This method is chainable as it returns the Pattern object</Note>
<Tip>
###### Anchor your samples
If you add a point named `anchor` to your pattern part, the different samples
will be anchored on this point.
In other words, for each sample, the anchor point will be kept in the same location.
</Tip>
## Pattern.sampleOption() signature
```js
@ -38,12 +31,12 @@ Pattern pattern.sampleOption(string option)
## Pattern.sampleOption() example
```js
import Aaron from "@freesewing/aaron"
import models from "@freesewing/models"
import { Aaron } from "@freesewing/aaron"
import { cisFemaleAdult34 } from "@freesewing/models"
const pattern = new aaron({
measurements: models.manSize38
const pattern = new Aaron({
measurements: cisFemaleAdult34
})
const svg = pattern.sampleOption("necklineDrop").render()
const svg = pattern.draft().sampleMeasurement('chest')
```