Coder Social home page Coder Social logo

satelllte / displacement Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 8.02 MB

▶▶▶ Moved into https://github.com/satelllte/displacementx | Displacement maps generator

Home Page: https://xdisplacement.netlify.app

License: GNU General Public License v3.0

Dockerfile 1.20% JavaScript 5.93% TypeScript 92.24% CSS 0.62%
displacement displacement-map generative-art jsplacement normal-maps pseudo-random-generator displacement-texture texture displacementx nextjs-typescript

displacement's People

Contributors

dependabot[bot] avatar satelllte avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

displacement's Issues

Worker setup

Communication between UI app and WASM should be done through Worker which runs in a separate thread allowing to render 8k images without freeze, control render loading state, etc.

UI: dark/light mode

Conditions:

  • by default, use system theme
  • implement styles
  • implement theme switcher (preserve user's preference in local storage)

add `Worker` extension type

Something like this:

// worker extension type
interface ExtendedWorker<MessageEventType> extends Worker {
  onmessage: ((ev: MessageEvent<MessageEventType>) => void) | null
  postMessage(message: MessageEventType, transfer: Transferable[]): void
  postMessage(message: MessageEventType, options?: StructuredSerializeOptions): void
  // ...
}

// usage
type MyWorker = ExtendedWorker<MyMessageType>

Offline indication

Offline detection can be implemented using:

  useEffect(() => {
    // TODO: notify user that the app is available for offline use
    // ...

    // https://developer.chrome.com/docs/workbox/modules/workbox-window/#register-a-service-worker-and-notify-the-user-the-very-first-time-that-service-worker-is-active
    // @ts-ignore
    const wb = window.workbox
    // @ts-ignore
    wb.addEventListener('activated', (event) => {
      if (!event.isUpdate) {
        console.info('WB | activated | event: ', event)
        
        // READY FOR OFFLINE USE   !!!!!!
        // do something with it ....
      }
    })
  }, [])

Workbox docs reference: https://developer.chrome.com/docs/workbox/modules/workbox-window/#register-a-service-worker-and-notify-the-user-the-very-first-time-that-service-worker-is-active

To turn off page reload after getting back online, reloadOnOnline: false can be set in next-pwa config: https://github.com/shadowwalker/next-pwa#available-options

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.