Skip to content

Commit 1ff8066

Browse files
author
v 1 r t l
authored
Merge pull request #208 from CodyJasonBennett/fix/glitch-offset
fix(Glitch): set non-null chromatic offset
2 parents 6d97387 + c48cd47 commit 1ff8066

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/effects/Glitch.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Vector2 } from 'three'
12
import { GlitchEffect, GlitchMode } from 'postprocessing'
23
import { Ref, forwardRef, useMemo, useLayoutEffect } from 'react'
34
import { ReactThreeFiber, useThree } from '@react-three/fiber'
@@ -21,9 +22,10 @@ export const Glitch = forwardRef<GlitchEffect, GlitchProps>(function Glitch(
2122
const delay = useVector2(props, 'delay')
2223
const duration = useVector2(props, 'duration')
2324
const strength = useVector2(props, 'strength')
25+
const chromaticAberrationOffset = useVector2(props, 'chromaticAberrationOffset')
2426
const effect = useMemo(
25-
() => new GlitchEffect({ ...props, delay, duration, strength }),
26-
[delay, duration, props, strength]
27+
() => new GlitchEffect({ ...props, delay, duration, strength, chromaticAberrationOffset }),
28+
[delay, duration, props, strength, chromaticAberrationOffset]
2729
)
2830
useLayoutEffect(() => {
2931
effect.mode = active ? props.mode || GlitchMode.SPORADIC : GlitchMode.DISABLED

0 commit comments

Comments
 (0)