Skip to content

Commit b4198d8

Browse files
Merge pull request #58 from PixelsCommander/effects
Fixed loading order
2 parents 84734a7 + 75ddca6 commit b4198d8

9 files changed

Lines changed: 65 additions & 54 deletions

File tree

demo/ripples.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,7 @@
8585
});
8686
}
8787
</script>
88-
89-
90-
91-
92-
93-
<script src="../dist/htmlgl.min.js"></script>
94-
<script src="../dist/htmlgl-effects.min.js"></script>
88+
<script src="../dist/htmlgl.js"></script>
89+
<script src="../dist/htmlgl-effects.js"></script>
9590
</body>
9691
</html>

dist/htmlgl-effects.js

Lines changed: 39 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/htmlgl-effects.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/htmlgl.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8783,10 +8783,7 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
87838783
this.glChildsReady = 0;
87848784
this.glParent = this.getGlParent();
87858785

8786-
if (HTMLGL.GLEffectsManager) {
8787-
this.effectsManager = new HTMLGL.GLEffectsManager(this);
8788-
}
8789-
8786+
this.initEffects();
87908787
this.bindCallbacks();
87918788
this.transformProperty = this.style.transform !== undefined ? 'transform' : 'WebkitTransform';
87928789
this.init();
@@ -9011,6 +9008,12 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
90119008
return this.sprite.stage;
90129009
}
90139010

9011+
p.initEffects = function () {
9012+
if (HTMLGL.GLEffectsManager) {
9013+
this.effectsManager = new HTMLGL.GLEffectsManager(this);
9014+
}
9015+
}
9016+
90149017
HTMLGL.GLElement = document.registerElement(HTMLGL.CUSTOM_ELEMENT_TAG_NAME, {
90159018
prototype: p
90169019
})

dist/htmlgl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gulp.task('default', function () {
1212
.pipe(gulp.dest('dist'));
1313

1414
//Effects add-on
15-
gulp.src(['bower_components/tween.js/build/tween.min.js', 'src/gl-effects-manager.js','src/effects/ripples.js'])
15+
gulp.src(['bower_components/tween.js/build/tween.min.js', 'src/effects/ripples.js', 'src/gl-effects-manager.js'])
1616
.pipe(concat(BUNDLE_NAME + '-effects.js'))
1717
.pipe(gulp.dest('dist'))
1818
.pipe(uglify(BUNDLE_NAME + '-effects.min.js'))

page/js/htmlgl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gl-effects-manager.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@
3131
}
3232

3333
w.HTMLGL.GLEffectsManager = GLEffectsManager;
34+
35+
//Reinitialize effects on elements
36+
w.HTMLGL.elements.forEach(function(element){
37+
element.initEffects();
38+
});
3439
})(window);

src/gl-element.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@
5151
this.glChildsReady = 0;
5252
this.glParent = this.getGlParent();
5353

54-
if (HTMLGL.GLEffectsManager) {
55-
this.effectsManager = new HTMLGL.GLEffectsManager(this);
56-
}
57-
54+
this.initEffects();
5855
this.bindCallbacks();
5956
this.transformProperty = this.style.transform !== undefined ? 'transform' : 'WebkitTransform';
6057
this.init();
@@ -279,6 +276,12 @@
279276
return this.sprite.stage;
280277
}
281278

279+
p.initEffects = function () {
280+
if (HTMLGL.GLEffectsManager) {
281+
this.effectsManager = new HTMLGL.GLEffectsManager(this);
282+
}
283+
}
284+
282285
HTMLGL.GLElement = document.registerElement(HTMLGL.CUSTOM_ELEMENT_TAG_NAME, {
283286
prototype: p
284287
})

0 commit comments

Comments
 (0)