html css opengl,GitHub - PixelsCommander/HTML-GL: Get as many FPS as you need and amazing effects by...

ec235891b11468bc0d4b5295245d1c25.png

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

968dd2f308b64856af795004ed301495.png

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

This element`s content is rendered in

WebGL

was it easy?

Feel free to use CSS, images and all you are common to in HTML/CSS world.

As jQuery plugin

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

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

6f0bd8c3a94f13f105d65e101c2fb849.png

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 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

How to use?

Include HTMLGL.js into project. Use tag name 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

Copyright 2015 Denis Radin aka PixelsCommander

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值