Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8b2fe9
commit 2dddf6a
Showing
9 changed files
with
13,682 additions
and
14,023 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useState } from 'react'; | ||
import sketch from '../sketch/index'; | ||
import { ParticleState } from '../types'; | ||
|
||
export default function useParticleConfig({ | ||
text = 'Halil Atilla', | ||
textSize = 160, | ||
flow = 0.3, | ||
topSpeed = 100, | ||
lifeSpan = 2000, | ||
flowOffset = 0, | ||
gravity = { direction: 90, force: 0 }, | ||
canvas = { width: 880, height: 300, bg: '#161c1e' }, | ||
colorSet = ['#fbbf24', '#e91e63', '#60a5fa', '#673ab7', '#65a30d'], | ||
}): ParticleState { | ||
const [state] = useState<ParticleState>({ | ||
colorSet, | ||
config: { | ||
text, | ||
textSize, | ||
flow, | ||
topSpeed, | ||
lifeSpan, | ||
flowOffset, | ||
gravity, | ||
canvas, | ||
}, | ||
sketch, | ||
}); | ||
|
||
return state; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { | ||
useEffect, | ||
useState, | ||
ComponentType, | ||
PropsWithChildren, | ||
} from 'react'; | ||
|
||
function withClientSideRendering<P extends object>( | ||
WrappedComponent: ComponentType<P> | ||
) { | ||
return (props: PropsWithChildren<P>) => { | ||
const [isClient, setIsClient] = useState(false); | ||
|
||
useEffect(() => { | ||
setIsClient(typeof window !== 'undefined'); | ||
}, []); | ||
|
||
if (!isClient) { | ||
return null; | ||
} | ||
|
||
return <WrappedComponent {...props} />; | ||
}; | ||
} | ||
|
||
export default withClientSideRendering; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
export interface TextParticlesProps { | ||
export interface ParticleState { | ||
colorSet: string[]; | ||
config: { | ||
text: string; | ||
textSize: number; | ||
flow?: number; | ||
topSpeed?: number; | ||
lifeSpan?: number; | ||
flowOffset?: number; | ||
gravity?: { | ||
direction?: number; | ||
force?: number; | ||
flow: number; | ||
topSpeed: number; | ||
lifeSpan: number; | ||
flowOffset: number; | ||
gravity: { | ||
direction: number; | ||
force: number; | ||
}; | ||
canvas: { | ||
width: number; | ||
height: number; | ||
bg?: string; | ||
bg: string; | ||
}; | ||
colorSet?: string[]; | ||
} | ||
}; | ||
sketch: (p5: any) => void; | ||
} |
Oops, something went wrong.