Coder Social home page Coder Social logo

peterekepeter / gl-transitions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gl-transitions/gl-transitions

0.0 2.0 0.0 466 KB

The open collection of GL Transitions

Home Page: https://gl-transitions.netlify.com/

Shell 9.38% GLSL 90.62%

gl-transitions's Introduction

Build Status

Each commit that gets to master automatically generate a new npm minor release.

See https://www.npmjs.com/package/gl-transitions

Specification

What is a transition?

A Transition is an animation that smoothly animates the intermediary steps between 2 textures.

The step is specified by a progress value that moves from 0.0 to 1.0.

important feature to respect: When progress is 0.0, exclusively the from texture must be rendered. When progress is 1.0, exclusively the to texture must be rendered.

GL Transition

A GL Transition is defined in the GLSL language and implements a function vec4 transition (vec2 uv). It takes the current coordinate position to render and returns the color of that pixel.

Transition parameters

If you need extra parameters for a transition, don't define them as "constant", instead expose them as uniforms. When you do so, define a default value following with a comment // = value

Examples:

uniform float foo; // = 42.0
uniform vec2 foo; // = vec2(42.0, 42.0)

Context

Variables in context (uniforms)

  • progress float that moves from 0.0 to 1.0
  • ratio a float equals to width / height. (width and height are not available because your code should be scalable to any size, however you can use this ratio to preserve your ratio, e.g. you want to draw squares)

extra functions

  • vec4 getFromColor(vec2 uv): lookup the "from" texture at a given uv coordinate.
  • vec4 getToColor(vec2 uv): lookup the "to" texture at a given uv coordinate.

don't use directly texture2D to get a texture pixel out of from and to. Instead, use getFromColor(vec2) and getToColor(vec2). That way, the "implementer" can properly implement ratio preserving support as well as chosing a different color for the "out of bound" case.

gl-transitions's People

Contributors

gre avatar

Watchers

 avatar  avatar

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.