Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/assets/css/appstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

body {
box-sizing: border-box;
padding: 20px 43px 0 43px;
/* padding: 20px 43px 0 43px; */
margin: 0;
font-family: Conv_InterstatePro-Regular;
font-weight: normal;
Expand Down
4 changes: 2 additions & 2 deletions demo/basic-dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2>
scaleX: 4,
scaleY: 4,
rotateZ: "360deg"
}, {duration: 1000})
}, {duration: 5000})
.then(function () {
Velocity(element, {
translateX: 0,
Expand All @@ -54,7 +54,7 @@ <h2>
scaleX: 1,
scaleY: 1,
rotateZ: "0"
}, {duration: 1000});
}, {duration: 5000});
});
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions demo/basic-webgl.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ <h2>
scaleX: 4,
scaleY: 4,
rotateZ: "360deg"
}, {duration: 1000}).then(function () {
}, {duration: 5000}).then(function () {
Velocity(element, {
translateX: 0,
translateY: 0,
scaleX: 1,
scaleY: 1,
rotateZ: "0"
}, {duration: 1000});
}, {duration: 5000});
});
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions demo/js/vendor/html2canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2088,12 +2088,12 @@ function renderWindow(node, container, options, windowWidth, windowHeight) {
canvas = renderer.canvas;
} else {
//If retina - increase bounds by two since we ve got 2x canvas from renderer
if (window.devicePixelRatio !== 1) {
/*if (window.devicePixelRatio !== 1) {
bounds.top = bounds.top * window.devicePixelRatio;
bounds.left = bounds.left * window.devicePixelRatio;
bounds.right = bounds.right * window.devicePixelRatio;
bounds.bottom = bounds.bottom * window.devicePixelRatio;
}
}*/

canvas = crop(renderer.canvas, {width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: clonedWindow.pageXOffset, y: clonedWindow.pageYOffset});
}
Expand Down Expand Up @@ -4632,7 +4632,7 @@ exports.parseBackgrounds = function(backgroundImage) {
};

exports.getDeviceRatio = function() {
return window.devicePixelRatio;
return 1;//window.devicePixelRatio;
};

exports.applyRatio = function(value) {
Expand Down
2 changes: 1 addition & 1 deletion demo/ripples.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<script src="../bower_components/promise-polyfill/Promise.min.js"></script>
<script src="../bower_components/webcomponents.js/CustomElements.min.js"></script>
<script src="./js/vendor/velocity.js"></script>
<script src="../../html2canvas/dist/html2canvas.js"></script>
<script src="./js/vendor/html2canvas.js"></script>
<script src="../bower_components/pixi/bin/pixi.js"></script>
<script src="../src/util.js"></script>
<script src="../src/gl-element-resolver.js"></script>
Expand Down
252 changes: 229 additions & 23 deletions dist/htmlgl-effects.js
100755 → 100644

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/htmlgl-effects.min.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/htmlgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2112,12 +2112,12 @@ function renderWindow(node, container, options, windowWidth, windowHeight) {
canvas = renderer.canvas;
} else {
//If retina - increase bounds by two since we ve got 2x canvas from renderer
if (window.devicePixelRatio !== 1) {
/*if (window.devicePixelRatio !== 1) {
bounds.top = bounds.top * window.devicePixelRatio;
bounds.left = bounds.left * window.devicePixelRatio;
bounds.right = bounds.right * window.devicePixelRatio;
bounds.bottom = bounds.bottom * window.devicePixelRatio;
}
}*/

canvas = crop(renderer.canvas, {width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: clonedWindow.pageXOffset, y: clonedWindow.pageYOffset});
}
Expand Down Expand Up @@ -4656,7 +4656,7 @@ exports.parseBackgrounds = function(backgroundImage) {
};

exports.getDeviceRatio = function() {
return window.devicePixelRatio;
return 1;//window.devicePixelRatio;
};

exports.applyRatio = function(value) {
Expand Down Expand Up @@ -8774,7 +8774,7 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
height = w.innerHeight;

//Update pixelRatio since could be resized on different screen with different ratio
HTMLGL.pixelRatio = window.devicePixelRatio || 1;
HTMLGL.pixelRatio = w.HTMLGL.getPixelRatio();

console.log(HTMLGL.pixelRatio);

Expand Down Expand Up @@ -8915,7 +8915,11 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
w.HTMLGL.enabled = false;
}

w.HTMLGL.pixelRatio = window.devicePixelRatio || 1;
w.HTMLGL.getPixelRatio = function() {
return 1;//window.devicePixelRatio || 1;
}

w.HTMLGL.pixelRatio = w.HTMLGL.getPixelRatio();

w.HTMLGL.GLContext = GLContext;
new GLContext();
Expand Down Expand Up @@ -9283,8 +9287,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
jQuery.fn[HTMLGL.JQ_PLUGIN_NAME] = function () {
return this.each(function () {
if (!jQuery.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME)) {
var propellerObj = HTMLGL.GLElement.createFromNode(this);
jQuery.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME, propellerObj);
var htmlGLobj = HTMLGL.GLElement.createFromNode(this);
jQuery.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME, htmlGLobj);
jQuery[HTMLGL.JQ_PLUGIN_NAME].elements.push(propellerObj);
}
});
Expand Down
26 changes: 13 additions & 13 deletions dist/htmlgl.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gulp.task('default', function () {
.pipe(gulp.dest('dist'));

//Effects add-on
gulp.src(['bower_components/tween.js/build/tween.min.js', 'src/effects/ripples.js', 'src/gl-effects-manager.js'])
gulp.src(['bower_components/tween.js/build/tween.min.js', 'src/effects/*.js', 'src/gl-effects-manager.js'])
.pipe(concat(BUNDLE_NAME + '-effects.js'))
.pipe(gulp.dest('dist'))
.pipe(uglify(BUNDLE_NAME + '-effects.min.js'))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-gl",
"version": "0.3.0",
"version": "0.3.1",
"description": "Get as many FPS as you need by rendering HTML/CSS in WebGL",
"main": "index.js",
"scripts": {
Expand Down
18 changes: 18 additions & 0 deletions src/effects/ascii.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function (w) {

var Ascii = function (element) {
this.element = element;
this.filter = new PIXI.filters.AsciiFilter();
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = Ascii.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.ascii = Ascii;
})(window);
18 changes: 18 additions & 0 deletions src/effects/bloom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function (w) {

var Bloom = function (element) {
this.element = element;
this.filter = new PIXI.filters.BloomFilter();
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = Bloom.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.bloom = Bloom;
})(window);
20 changes: 20 additions & 0 deletions src/effects/diagonal-blur.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function (w) {

var DiagonalBlur = function (element) {
this.element = element;
this.filter = new PIXI.filters.BlurDirFilter(2, 2);
this.filter.passes = 2;
this.filter.blur = 3;
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = DiagonalBlur.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.diagonalblur = DiagonalBlur;
})(window);
20 changes: 20 additions & 0 deletions src/effects/dotscreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function (w) {

var DotScreen = function (element) {
this.element = element;
this.filter = new PIXI.filters.DotScreenFilter();
this.filter.scale = parseInt(this.element.getAttribute('dotScreenScale')) || 1;
this.filter.angle = parseInt(this.element.getAttribute('dotScreenAngle')) || 1;
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = DotScreen.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.dotscreen = DotScreen;
})(window);
18 changes: 18 additions & 0 deletions src/effects/invert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function (w) {

var Invert = function (element) {
this.element = element;
this.filter = new PIXI.filters.InvertFilter();
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = Invert.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.invert = Invert;
})(window);
18 changes: 18 additions & 0 deletions src/effects/noise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function (w) {

var Noise = function (element) {
this.element = element;
this.filter = new PIXI.filters.NoiseFilter();
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = Noise.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.noise = Noise;
})(window);
20 changes: 20 additions & 0 deletions src/effects/pixelate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function (w) {

var Pixelate = function (element) {
this.element = element;
this.filter = new PIXI.filters.PixelateFilter();
this.filter.size.x = parseInt(this.element.getAttribute('pixelSizeX')) || 2;
this.filter.size.y = parseInt(this.element.getAttribute('pixelSizeY')) || 2;
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = Pixelate.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.pixelate = Pixelate;
})(window);
18 changes: 18 additions & 0 deletions src/effects/rgbsplit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function (w) {

var RGBSplit = function (element) {
this.element = element;
this.filter = new PIXI.filters.RGBSplitFilter();
this.element.sprite.filters = (this.element.sprite.filters || []).concat(this.filter);
}

var p = RGBSplit.prototype;

p.destroy = function () {
var filterIndex = this.element.sprite.filters.indexOf(this.filter);
this.element.sprite.filters = this.element.sprite.filters.splice(filterIndex, 1);
}

w.HTMLGL.effects = w.HTMLGL.effects || {};
w.HTMLGL.effects.rgbsplit = RGBSplit;
})(window);
36 changes: 24 additions & 12 deletions src/effects/ripples.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading