Skip to main content

Function: stampParams()

stampParams(preset, size, input, random?): StampParams

Defined in: src/lib/brushes/params/index.ts:139

Work out one stamp's size, rotation, offset and alpha from the preset, the user's chosen size and the input at that point (see BrushParamConfig): each varied parameter's value is as far between its range's ends as its sources' share.

  • Size and alpha go from min × the value to the value (sizes at least MIN_STAMP_SIZE).
  • Rotation goes from the angle + min to the angle + max degrees (0 to 360 without a range). With rotationFollowsLean, the direction the pen leans is added; without a range, tilt sets that direction instead.
  • Offsets go from min to max pixels, added to the offset. Without a range, they scatter up to the share × the size in a random direction.

Parameters​

preset​

BrushConfig

size​

height​

number

width​

number

input​

PointInput

random?​

RandomFn = Math.random

Returns​

StampParams

Example​

stampParams(preset, { width: 20, height: 20 }, { isPen: true, pressure: 0.5 });