transparent background example added
This commit is contained in:
parent
cfdd3ae044
commit
f2fe7292c8
3 changed files with 4062 additions and 0 deletions
BIN
examples/example 7 - Transparent Background/bunny.png
Normal file
BIN
examples/example 7 - Transparent Background/bunny.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 449 B |
73
examples/example 7 - Transparent Background/index.html
Normal file
73
examples/example 7 - Transparent Background/index.html
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>pixi.js example 1</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textHolder{
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="pixi.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/WebGLRenderer.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="textHolder">Hi there, I'm some HTML text... blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
|
||||||
|
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
// create an new instance of a pixi stage
|
||||||
|
var stage = new PIXI.Stage(0x66FF99);
|
||||||
|
|
||||||
|
// create a renderer instance
|
||||||
|
var renderer = PIXI.autoDetectRenderer(400, 300, null, true);
|
||||||
|
|
||||||
|
// add the renderer view element to the DOM
|
||||||
|
document.body.appendChild(renderer.view);
|
||||||
|
renderer.view.style.position = "absolute";
|
||||||
|
renderer.view.style.top = "0px";
|
||||||
|
renderer.view.style.left = "0px";
|
||||||
|
requestAnimFrame( animate );
|
||||||
|
|
||||||
|
// create a texture from an image path
|
||||||
|
var texture = PIXI.Texture.fromImage("bunny.png");
|
||||||
|
// create a new Sprite using the texture
|
||||||
|
var bunny = new PIXI.Sprite(texture);
|
||||||
|
|
||||||
|
// center the sprites anchor point
|
||||||
|
bunny.anchor.x = 0.5;
|
||||||
|
bunny.anchor.y = 0.5;
|
||||||
|
|
||||||
|
// move the sprite t the center of the screen
|
||||||
|
bunny.position.x = 200;
|
||||||
|
bunny.position.y = 150;
|
||||||
|
|
||||||
|
stage.addChild(bunny);
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
|
||||||
|
requestAnimFrame( animate );
|
||||||
|
|
||||||
|
// just for fun, lets rotate mr rabbit a little
|
||||||
|
bunny.rotation += 0.1;
|
||||||
|
|
||||||
|
// render the stage
|
||||||
|
renderer.render(stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
3989
examples/example 7 - Transparent Background/pixi.js
Normal file
3989
examples/example 7 - Transparent Background/pixi.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue