8000 GitHub - Chajac/ASCII: THREE.js ASCII Effect on the GPU
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ ASCII Public
forked from emilwidlund/ASCII

THREE.js ASCII Effect on the GPU

Notifications You must be signed in to change notification settings

Chajac/ASCII

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII

An ASCII effect for THREE.js - which runs as a fragment shader on the GPU.

Supported Props

interface IASCIIEffectProps {
    characters?: string; // The ASCII characters to use in brightness order dark -> light
    fontSize?: number; // Font Size of the characters drawn to the texture
    cellSize?: number; // Size of each cell in the grid
    blockSize?: number; // Cluster size of each cell
    invert?: boolean; // Flag which inverts the effect
    fgColor?: string; // Color of the characters
    bgColor?: string; // Background color of the cells.
    useColorArray?: boolean; // Flag to toggle custom color array use
    colorArray?: string[]; // Provide a custom color array to use
    useOriginalColors?: boolean; // Flag to use whatever original colors drive the shader
    brightness?: number;
    charAspectRatio?: number; // Stretch characters over the X axis.
    disabled?: boolean; // Disable the effect
}

Example with @react-three/fiber

import React from 'react';
import { Canvas } from '@react-three/fiber';
import { EffectComposer } from '@react-three/postprocessing';

const Scene = () => {
    const asciiEffect = React.useMemo(() => new ASCIIEffect(), []);

    return (
        <Canvas>
            <mesh>
                <boxGeometry args={[1, 1, 1]} />
                <meshPhongMaterial />
            </mesh>
            <pointLight position={[0, 0, 10]} />
            <EffectComposer>
                <primitive object={asciiEffect} />
            </EffectComposer>
        </Canvas>
    );
};

About

THREE.js ASCII Effect on the GPU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.2%
  • JavaScript 2.3%
  • HTML 1.8%
  • CSS 1.7%
0