• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript pixi.js类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中pixi.js的典型用法代码示例。如果您正苦于以下问题:TypeScript js类的具体用法?TypeScript js怎么用?TypeScript js使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了js类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: animate

import * as PIXI from 'pixi.js';

var renderer = PIXI.autoDetectRenderer(800, 600, {backgroundColor: 0x1099bb});
document.body.appendChild(renderer.view);

var stage = new PIXI.Container();
var texture = PIXI.Texture.fromImage('bunny.png');
var bunny = new PIXI.Sprite(texture);
bunny.anchor.x = 0.5;
bunny.anchor.y = 0.5;
bunny.position.x = 400;
bunny.position.y = 300;
bunny.scale.x = 2;
bunny.scale.y = 2;
stage.addChild(bunny);
animate();

function animate() {
    requestAnimationFrame(animate);
    var bunny = stage.getChildAt(0);
    bunny.rotation += 0.01;
    renderer.render(stage);
}
开发者ID:overthink,项目名称:pixitest,代码行数:23,代码来源:helloworld.ts


示例2: hi

"use strict";

import * as PIXI from 'pixi.js';
import { Observable } from 'rxjs/Observable';
import { greet } from './greet';

function hi(word:string = "TypeScript!!!!!!!!!!!!!!"):void {
  greet(word);
}
hi();

//const renderer:PIXI.WebGLRenderer | PIXI.CanvasRenderer = PIXI.autoDetectRenderer(800, 600, { transparent: true });
// const stage = new PIXI.Stage();
const stage = new PIXI.Container();
const renderer = PIXI.autoDetectRenderer(800, 600, { transparent: true });
document.body.appendChild(renderer.view);

const texture = PIXI.Texture.fromImage('bunny.png');
const bunny = new PIXI.Sprite(texture);
bunny.anchor.x = 0.5;
bunny.anchor.y = 0.5;
bunny.position.x = 200;
bunny.position.y = 150;

stage.addChild(bunny);

animate();
function animate() {
    requestAnimationFrame(animate);
    bunny.rotation += 0.1;
开发者ID:bokuweb,项目名称:rx-pixi-sandbox,代码行数:30,代码来源:index.ts


示例3: constructor

    constructor(private htmlContainer:HTMLElement){
        this.renderer = PIXI.autoDetectRenderer(htmlContainer.clientWidth, htmlContainer.clientHeight, {antialias:true});
        this.renderer.backgroundColor = 0xFF0000;
        htmlContainer.appendChild(this.renderer.view);

        //Hack: interaction data objects are reused making it difficult to store info on them
        //this is a hack to remove the "selection" property on every click so it can be used
        //by the rest of hte system to bubble what has been clicked in
        // let plugins = ((<any>this.renderer).plugins);
        // let interactionManager = (<InteractionManager>plugins.interaction);
        // let clearData = function(displayObject, eventString, eventData){
        //     debugger;
        //     delete (<any>interactionManager.eventData.data).selection;
        // }
        // this.interceptBefore(interactionManager, "onMouseUp",clearData)
        // this.interceptBefore(interactionManager, "onMouseDown",clearData)
        // interactionManager.setTargetElement(interactionManager.interactionDOMElement, interactionManager.resolution);


        this.container = new PIXI.Container();
        this.container.addChild(DebugDraw.Global)

        this.animate();

        window.addEventListener('resize', ()=>{
            if(htmlContainer.clientWidth != this.renderer.width
                || htmlContainer.clientHeight != this.renderer.height){
                this.renderer.resize(htmlContainer.clientWidth, htmlContainer.clientHeight);
                this.setScene(this.currentScene);

            }
        })
    }
开发者ID:codecutout,项目名称:Trader,代码行数:33,代码来源:SceneManager.ts


示例4: function

	"addAtBack": false,
	"spawnType": "circle",
	"spawnCircle": {
		"x": 0,
		"y": 0,
		"r": 0
	}
};
const canvas = document.getElementById("stage") as HTMLCanvasElement;
// Basic PIXI Setup
const rendererOptions =
{
	view: canvas,
};
const stage = new pixi.Container(),
	renderer = pixi.autoDetectRenderer(canvas.width, canvas.height, rendererOptions);
let emitter:particles.Emitter = null,
	bg:pixi.Sprite = null;

// Calculate the current time
let elapsed = Date.now();

let updateId:number;
// Update function every frame
const update = function(){

	// Update the next frame
	updateId = requestAnimationFrame(update);

	const now = Date.now();
	if (emitter)
开发者ID:pixijs,项目名称:pixi-particles,代码行数:31,代码来源:renderer.ts



注:本文中的pixi.js类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript pixi.js.Container类代码示例发布时间:2022-05-25
下一篇:
TypeScript pino.Logger类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap