Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path="defs/easeljs.d.ts" />
- /// <reference path="CustomShape.ts"/>
- module djankey {
- export class Shape3D extends createjs.Bitmap {
- private sid:number = Math.random()*1000;
- public power:number = 100+50*Math.random();
- private vx:number;
- private vy:number;
- private rSpeed:number = Math.random() / 300;
- constructor(c:any) {
- super(c);
- 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;
- }
- public update = (t:number):void => {
- var ft:number = this.sid + t * this.rSpeed;
- this.rotation = this.sid + t * this.rSpeed;
- this.scaleX = Math.sin(ft);
- this.scaleY = 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