mirror of
https://github.com/wassname/phaser.git
synced 2026-07-01 16:50:43 +08:00
Updated Filter resolution to a 2f and added Blur and Marble filters.
This commit is contained in:
@@ -178,6 +178,10 @@
|
||||
}
|
||||
],
|
||||
"filters": [
|
||||
{
|
||||
"file": "blur.js",
|
||||
"title": "blur"
|
||||
},
|
||||
{
|
||||
"file": "checker+wave.js",
|
||||
"title": "checker wave"
|
||||
@@ -186,10 +190,6 @@
|
||||
"file": "fire.js",
|
||||
"title": "fire"
|
||||
},
|
||||
{
|
||||
"file": "hue+rotate.js",
|
||||
"title": "hue rotate"
|
||||
},
|
||||
{
|
||||
"file": "lightbeams.js",
|
||||
"title": "lightbeams"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('phaser', 'assets/sprites/phaser2.png');
|
||||
game.load.script('filterX', '../filters/BlurX.js');
|
||||
game.load.script('filterY', '../filters/BlurY.js');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'phaser');
|
||||
logo.anchor.setTo(0.5, 0.5);
|
||||
|
||||
var blurX = game.add.filter('BlurX');
|
||||
var blurY = game.add.filter('BlurY');
|
||||
|
||||
logo.filters = [blurX, blurY];
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
var background;
|
||||
var filter;
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('phaser', 'assets/sprites/phaser2.png');
|
||||
game.load.script('filter', '../filters/HueRotate.js');
|
||||
// game.load.image('texture', 'assets/textures/ooze.png');
|
||||
game.load.image('texture', 'assets/pics/ra_einstein.png');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'texture');
|
||||
logo.anchor.setTo(0.5, 0.5);
|
||||
logo.texture.baseTexture._powerOf2 = true;
|
||||
|
||||
|
||||
background = game.add.sprite(0, 0);
|
||||
background.width = logo.width;
|
||||
background.height = logo.height;
|
||||
|
||||
filter = game.add.filter('HueRotate', logo.width, logo.height, logo.texture);
|
||||
// filter.alpha = 0.0;
|
||||
|
||||
background.filters = [filter];
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
filter.update();
|
||||
|
||||
}
|
||||
@@ -21,7 +21,12 @@ function create() {
|
||||
background.height = 600;
|
||||
|
||||
filter = game.add.filter('Marble', 800, 600);
|
||||
//filter.alpha = 0.0;
|
||||
filter.alpha = 0.2;
|
||||
|
||||
// The following properties are available (shown at default values)
|
||||
|
||||
// filter.speed = 10.0;
|
||||
// filter.intensity = 0.30;
|
||||
|
||||
background.filters = [filter];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user