• Stars
    star
    3,448
  • Rank 12,442 (Top 0.3 %)
  • Language
    JavaScript
  • Created about 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Get as many FPS as you need and amazing effects by rendering HTML/CSS in WebGL

HTML GL

60 FPS and amazing effects by rendering HTML/CSS in WebGL, framework agnostic

Gitter chat

HTML GL solves "the slow DOM problem" by creating WebGL representations of DOM elements and hiding actual DOM after. This speeds up HTML/CSS animations and transformations by using 3D hardware acceleration and allows to apply OpenGL effects as modern 3D games have.

Using HTML GL you still work with HTML/CSS as you are common to, but DOM elements are just facades to their WebGL representations. These GPU accelerated textures are very effective from resources consuming perspective and are very cheap to transform or animate.

Install

npm:

npm install --save html-gl

Bower:

bower install --save htmlgl

Usage

As Web Component

<html-gl>
    This element`s content is rendered in <h1>WebGL</h1>
    <span style="color: green;">was it easy?</span>
    Feel free to use CSS, images and all you are common to in HTML/CSS world.
</html-gl>

As jQuery plugin

$('.some div').htmlgl();

No DOM + WebGL rendering = highest FPS possible for Web platform

HTML GL flow diagram

Demos

  • Filters WebGL is not only about performance. It breaks any HTML/CSS limits in terms of animations and interactivity
  • Mobile effects use attribute effects on <html-gl> element to specify effects you use, this one is nice for mobile
  • Basic HTML GL demo shows how to use HTML GL and animate GL Elements. It also demonstrate that HTML GL handle content change events and repaints element`s WebGL representation
  • Basic DOM this is the same project as previous. The only difference is that htmlgl.js is not included
  • Advanced content HTML GL slider with nested content rendered via WebGL and animated, ability to drag with mouse horizontaly, click event listeners on boxes
  • Advanced content DOM

How to use?

Include HTMLGL.js into project. Use tag name <html-gl> or jQuery plugin $(myElement).htmlgl() for elements you are going to animate. These elements will be rendered in WebGL and their CSS Transform properties will be mapped to WebGL representation transformations. So DOM node itself will not be animated or displayed in order to avoid resources consuming. HTML GL is framework agnostic and is easy to inject into existing project which needs performance tweaking.

Rasterization API

In order to improve technology we are trying to promote standardized native Rasterization API for JavaScript. Help us to be better and to add this cool feature to browsers by spreading the article and proposal draft.

Fast way to animate

The most performant way to animate HTML-GL tags is to operate on tag's styleGL.transform in the same way you operate on style.transform. E.g. style.transform = 'translateX(100px) translateY(50px)'. Velocity.js copy from HTML-GL repository (https://github.com/PixelsCommander/HTML-GL/blob/master/demo/js/vendor/velocity.js) have this optimization built-in. Feel free to use it in the way described in official Velocity.js documentation.

Animating HTML-GL tag children

Since it is very efficient to make transformations (move, rotate, scale, change opacity) on HTML-GL tags it becomes very slow to animate it's children until they are HTML-GL tags too. This happens because of necessity to rasterize and send HTML-GL tag texture to GPU.

Running demos from repository

Please run bower install before running demos

License

MIT: http://mit-license.org/

Copyright 2015 Denis Radin aka PixelsCommander

More Repositories

1

ViralJS

Express.JS middleware to enable P2P distribution for your app. Your decentralized CDN made easy.
JavaScript
958
star
2

Propeller

JavaScript library to rotate elements with mouse or touch gestures. Supports inertia and stepwise rotation. Optimized for better performance.
JavaScript
407
star
3

Download-File-JS

Intelligent JavaScript solution for file downloading.
JavaScript
200
star
4

FlashJS

JavaScript graphics and games engine with API similar to Flash one. Just look to examples sources.
JavaScript
173
star
5

pixi-sdf-text

Signed distance field text implementation for PixiJS
JavaScript
95
star
6

OnlineJS

Reliable, fast and easy to use library to check your internet connection status
JavaScript
68
star
7

requestIdleCallback-polyfill

Polyfill for request idle callback. Determines is user interacting with document and fires when it is not or after interaction is finished.
JavaScript
52
star
8

polymer-native

Develop completely native mobile apps with Web Components
JavaScript
46
star
9

CanvasImage

Converts image to canvas with same look. Useful for memory optimization in case of responsive image usage. Also is good for solving PhoneGap Android anti aliasing issue.
JavaScript
33
star
10

pixel-shaders-workshop

GLSL
28
star
11

PrayerWheel

Produces positive karma when spinning, blessing all living beings around and purifying karma of the one who spins it
TypeScript
22
star
12

React-GL

Render React components in WebGL for 60 FPS animations
JavaScript
21
star
13

glsl-component

Lightweight library for GLSL rendered web components
HTML
16
star
14

HTML-Aircraft-Indicators

Indicators for multifunctional display built with HTML
CSS
15
star
15

Mobile-Transitions

High performance JavaScript library to emulate native mobile transitions. Designed to be as easy to use as possible. Just look to example.
JavaScript
11
star
16

webgpu-vs-webgl-compute-matrix-multiplication

WebGL vs WebGPU vs JavaScript demo shows the difference in performance when naively multiplying some matrices
JavaScript
8
star
17

Telekinesis-JS

JavaScript multiplayer game engine. Using Node.JS for server and any graphic library for client-side.
JavaScript
8
star
18

isAntialiasingSupportedForWebGL

gl.antialias=true does not guarantee it is actually going to be ON because browser accepts antialias attribute just as a hint and decides on itself there. This library checks for actual AA availability.
JavaScript
5
star
19

StyleObserver

The StylesObserver library provides the ability to watch for changes being made to the styles of the element
TypeScript
4
star
20

fps-control-chrome-extension

Control FPS in your browser for testing, performance investigation or to stress your app with dropped frames
JavaScript
4
star
21

GetterSetterJS

Π‘ross-browser way to getters and setters
JavaScript
3
star
22

PerFix

Rendering smoothness benchmark for scientific - blended performance optimization, written in JavaScript
JavaScript
2
star
23

QuickContext

ContextAPI state management made Easy. Less code more performance.
JavaScript
1
star
24

CodeTone

Let code play!
CSS
1
star