diff --git a/CHANGELOG.md b/CHANGELOG.md index 3afa810..a3950dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### 0.14.7 (2024-12-19) + +_New:_ + +- Added `offsetInput` property to `slitScan` effect for allowing exposing an offset variable. + ### 0.14.6 (2024-12-18) _Fixed:_ diff --git a/dist/index.cjs b/dist/index.cjs index 99c6b6c..959bc9a 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1339,6 +1339,7 @@ function kaleidoscope ({ segments = 6, offset, rotation = 0 } = {}) { * @param {number} [params.intensity=0.1] initial intensity to use. * @param {number} [params.frequency] initial frequency to use . * @param {string} [params.direction='x'] direction to apply the slit scan effect. + * @param {string} [params.offsetInput] code to use as input for adding offset. Defaults to empty. * @returns {slitScanEffect} * * @example slitScan({intensity: 0.5, frequency: 3.0}) @@ -1349,6 +1350,7 @@ function slitScan ({ intensity = 0.1, frequency = 2.0, direction = 'x', + offsetInput = '', }) { /** * @typedef {Object} slitScanEffect @@ -1362,7 +1364,7 @@ function slitScan ({ * effect.frequency = 3.5; */ const isHorizontal = direction === 'x'; - const noiseFragPart = `gl_FragCoord.${direction} / u_resolution.${direction} * u_frequency`; + const noiseFragPart = `(gl_FragCoord.${direction} / u_resolution.${direction}${offsetInput ? `+ ${offsetInput}` : ''}) * u_frequency`; const noiseTimePart = 'u_time * 0.0001'; return { diff --git a/docs/index.html b/docs/index.html index 138913e..b22c744 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@
-