Search the Community
Showing results for tags 'pryme8'.
-
Hello everyone, I am new tophaser. I am trying to draw small circle using bitmapData. when the function lunchFrom and loop calling without time event function it's fine working but when I am tryting call the function using this.game.time.event then nothing to draw on canvas. please help me. Thanks is advance . Please find below the code which I am using. this.game = new Phaser.Game(1152, 648, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); let particles = []; let mousePos = { x: 200, y: 200 } function preload() { } function create() { this.bmdAnimation = this.game.add.bitmapData(1152, 648); this.animationSprite = this.game.add.sprite(0, 0, this.bmdAnimation); this.context = this.bmdAnimation.ctx; // launchFrom.apply(this); // loop.apply(this); this.game.time.events.add(800, launchFrom, this); this.game.time.events.add(20, loop, this); } function update() { } function launchFrom() { mousePos.y-=5; let particle = new Particle(mousePos); particles.push(particle); } function loop() { for (let i = 0; i < particles.length; i++) { particles[i].update(); particles[i].render(this.context); } } export class Particle { position: any; color: number; alpha: number; size: number; flick: boolean; constructor(position) { this.position = { x: position ? position.x : 0, y: position ? position.y : 0 } this.color = Math.random() * 100 - 30; this.alpha = 1; this.size = 30; this.flick = false; } update() { this.position.y -= 0.1; } render(ctx) { ctx.save(); ctx.globalCompositeOperation = 'lighter'; var x = this.position.x; var y = this.position.y; var r = this.size / 2; var gradient = ctx.createRadialGradient(x, y, 0.1, x, y, r); gradient.addColorStop(0.1, "rgba(255,255,255," + this.alpha + ")"); gradient.addColorStop(0.8, "hsla(" + this.color + ", 100%, 50%, " + this.alpha + ")"); gradient.addColorStop(1, "hsla(" + this.color + ", 100%, 50%, 0.1)"); ctx.fillStyle = gradient; ctx.beginPath(); ctx.arc(this.position.x, this.position.y, this.flick ? Math.random() * this.size : this.size, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); ctx.restore(); }; }
-
Hello, I haven't yet seen a post such as what I'm currently writing, but I thought it wise to post how this forum is beginning to bring users together on real world projects. I recently took on a project which as briefly described to me seemed simple enough. Although it was a very short schedule to deliver. One week prior, a key developer @Pryme8 who is often seen on this forum offered to show me how I might optimize code I had posted previously, and I thought to reach out to him directly. Within the first week, I learned that the scope of the project was far in advance of the initial description. Thus, I instictively knew that I would not be able to deliver the project on time, and also lacked some of the fundamental experience required to complete the project on schedule. So I reached out to @Pryme8, and asked if he had time to assist. He was on another project at the time, but was free for one week before my delivery to assist with my project. I'm happy to say that the delivery is now happening this week, and not only was he able to assist, but I learned much from working directly with him. Not to mention, his code is as close to perfection as I've ever seen - but that's perhaps for another post. So what I hope to come from this post, is that we are always stronger working together, as is the world of open source, and if you ever have the opportunity to work with @Pryme8 (I'll with hold his real name for now)I highly recommend you jump at the chance. I could not have delivered my project without this forum, the help from all users, and speificaly the vast experience from the one user I was lucky enough to have contacted me prior. This forum rocks! DB
- 4 replies
-
- clean code
- complex
-
(and 1 more)
Tagged with:
-
INTRODUCING WUKONG! In order to increase productivity and give you more resources at your fingertips I am proud to present WUKONG! This plugin will extend your babylon.js playground and add useful features for creation of babylon.js common objects and methods. This is the first release so it is limited on what I have as far as objects available, but that list will be growing very rapidly as I make my way through the API. You have the option to include code hints for the inserted items Parameters, Members, and Methods. Many more Macros and Objects will be added soon. to include in your playground simply add the line: $.getScript("http://pryme8.github.io/WUKONG/WUKONG.js"); before your scene function and hit run and WUKONG does the rest! to keep up to date follow: https://github.com/Pryme8/WUKONG This plugin is not supported or maintained by BABYLON.JS and is the sole rights of its author (me ^_^). for a working example go to:http://www.babylonjs-playground.com/#5FLDS#0 and just look for the WUKONG button. /h for Variable hints, /mb for member hints, /md for methods hints! Just check on which hints you want to Copy with your Prefab. When you click on a Highlighted Prefab it will be added to your clipboard simply go to the line you wish to add it to and paste (ctrl-v). Please let me know what features you want added, and what compatibility issues that arise in different browsers. Thank you and have a nice day! ***UPDATE*** Current Support List: Numbers : Vector3, Color3 (I need to add a lot more of these...) Basics: CreateBox, CreateSphere, CreatePlane, CreateDisc, CreateCylinder, CreateTorus, CreateTorusKnot, Lines (BasicLine, more to come), CreateRibbon, CreateTube, DisplaySettings(SideOrentation) Cameras: FreeStandard, ArcRotateStandard, TouchStandard, DeviceOStandard, FollowStandard, VirtualJoyStandard, GamepadStandard, FreeAnaglyph, ArcRotateAnaglyph Lights: PointLight, DirectionalLight, SpotLight, HemisphericLight lots more to come soon... like I said any requests please let me know.