Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path="defs/PIXI.d.ts" />
- module djankey {
- export class Shape3DImage extends PIXI.Sprite {
- private sid:number;
- public power:number = 100+50*Math.random();
- private vx:number;
- private vy:number;
- private rSpeed:number = Math.random() / 300;
- constructor(tex:PIXI.Texture, id:number) {
- super(tex);
- this.sid = id;
- var speed:number = 10*(.2 + Math.random());
- var a3:number = 2 * Math.PI * Math.random();
- this.vx = Math.sin(a3) * speed;
- this.vy = Math.cos(a3) * speed;
- this.interactive = false;
- }
- public update = (t:number):void => {
- var ft:number = this.sid + t * this.rSpeed;
- this.rotation = this.sid + t * this.rSpeed;
- this.scale.x = Math.sin(ft);
- this.scale.y = Math.cos(ft);
- this.power--;
- this.alpha = this.power / 100;
- this.vy += .1;
- this.vx *= .95;
- this.vy *= .95;
- this.x += this.vx;
- this.y += this.vy;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement