repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
ourcade/phaser3-typescript-examples
src/audio/web-audio/reuse-audio-context/ReuseAudioContext.ts
import Phaser from 'phaser' import config from './config' export default class ReuseAudioContext extends Phaser.Scene { preload() { this.load.spritesheet('explosion','/assets/atlas/trimsheet/explosion.png', { frameWidth: 64, frameHeight: 64 }) this.load.spritesheet('bomb','/assets/sprites/xenon2_bomb.png', { fra...
ourcade/phaser3-typescript-examples
src/animation/multi-atlas-animation/MultiAtlasAnimation.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class MultiAtlasAnimation extends Phaser.Scene { preload() { this.load.multiatlas({ key:'cybercity', atlasURL: '/assets/animations/cybercity/cybercity-multi.json', path: '/assets/animations/cybercity' }) } cre...
ourcade/phaser3-typescript-examples
src/camera/world-view/WorldView.ts
import Phaser from 'phaser' import dat from 'dat.gui' export default class WorldView extends Phaser.Scene { private controls!: Phaser.Cameras.Controls.SmoothedKeyControl preload() { this.load.image('grid', '/assets/pics/uv-grid-4096-ian-maclachlan.png') } create() { this.add.image(0, 0, 'grid').setOrigin(...
ourcade/phaser3-typescript-examples
src/demoscene/raster-carpet/RasterCarpet.ts
import Phaser from 'phaser' export default class RasterCarpet extends Phaser.Scene { preload() { this.load.image('raster', '/assets/demoscene/raster-bw-800x16.png') } create() { const group = this.add.group() group.createMultiple({ key: 'raster', repeat: 64 }) const hsv = Phaser.Display.Color.HSVColorW...
ourcade/phaser3-typescript-examples
src/actions/rotate-around-distance/RotateAroundDistance.ts
import Phaser from 'phaser' export default class RotateAroundDistance extends Phaser.Scene { private group!: Phaser.GameObjects.Group preload() { this.load.image('ball','/assets/sprites/shinyball.png') } create() { this.group = this.add.group() for (var i = 0; i < 32; i++) { this.group.create(i * 3...
ourcade/phaser3-typescript-examples
src/animation/export-json/ExportJson.ts
import Phaser from 'phaser' export default class ExportJson extends Phaser.Scene { preload() { this.load.atlas('gems','/assets/tests/columns/gems.png','/assets/tests/columns/gems.json') } create() { this.anims.create({ key: 'diamond', frames: this.anims.generateFrameNames('gems', { prefix: 'diamond_', end: 1...
ourcade/phaser3-typescript-examples
src/actions/rotate-container-facing-point/RotateContainerFacingPoint.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class RotateContainerFacingPoint extends Phaser.Scene { private center = {x: 400, y: 300} private container!: Phaser.GameObjects.Container private rotateSpeed = 0.02 preload() { this.load.spritesheet('diamonds','/assets/sp...
ourcade/phaser3-typescript-examples
src/actions/place-on-part-of-a-circle/PlaceOnPartOfACircle.ts
<reponame>ourcade/phaser3-typescript-examples<gh_stars>10-100 import Phaser from 'phaser' export default class PlaceOnPartOfACircle extends Phaser.Scene { private group1!: Phaser.GameObjects.Group private group2!: Phaser.GameObjects.Group private group3!: Phaser.GameObjects.Group private group4!: Phaser.GameObject...
ourcade/phaser3-typescript-examples
src/animation/on-repeat-callback/OnRepeatCallback.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class OnRepeatCallback extends Phaser.Scene { preload() { this.load.atlas('gems','/assets/tests/columns/gems.png','/assets/tests/columns/gems.json') } create() { // NOTE: onRepeat property doesn't exist; using ANIMATION_REPEAT // event instead c...
ourcade/phaser3-typescript-examples
src/camera/fade/Fade.ts
<filename>src/camera/fade/Fade.ts import Phaser from 'phaser' export default class Fade extends Phaser.Scene { preload() { this.load.image('pic', '/assets/pics/a-new-link-to-the-past-by-ptimm.jpg') this.load.image('logo', '/assets/sprites/phaser3-logo.png') } create() { this.add.image(400, 300, 'pic') ...
ourcade/phaser3-typescript-examples
src/camera/render-to-texture-shader-2/CustomPipeline.ts
<filename>src/camera/render-to-texture-shader-2/CustomPipeline.ts<gh_stars>10-100 import Phaser from 'phaser' export default class CustomPipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline { constructor(game: Phaser.Game) { super({ game: game, renderer: game.renderer, ...
ourcade/phaser3-typescript-examples
src/camera/single-small-camera/main.ts
<reponame>ourcade/phaser3-typescript-examples<gh_stars>10-100 import Phaser from 'phaser' import SingleSmallCamera from './SingleSmallCamera' import Test1 from './Test1' import Test2 from './Test2' import Test3 from './Test3' import Test4 from './Test4' import Test5 from './Test5' const config: Phaser.Types.Core.Game...
ourcade/phaser3-typescript-examples
src/camera/16-camera-shader-test/main.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' import CameraShaderTest from './CameraShaderTest' const config: Phaser.Types.Core.GameConfig = { type: Phaser.AUTO, width: 1024, height: 512, parent: 'phaser-example', scene: [CameraShaderTest], scale: { mode: Phaser.Scal...
ourcade/phaser3-typescript-examples
src/components/data/data-values/DataValues.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class DataValues extends Phaser.Scene { preload() { this.load.image('gem', '/assets/sprites/gem.png') } create() { const text = this.add.text(350, 270, 'Waiting...', { font: '16px Courier', fill: '#00ff00' }) const ge...
ourcade/phaser3-typescript-examples
src/camera/rotate-camera/RotateCamera.ts
import Phaser from 'phaser' interface WASDKeys { W: Phaser.Input.Keyboard.Key A: Phaser.Input.Keyboard.Key S: Phaser.Input.Keyboard.Key D: Phaser.Input.Keyboard.Key } export default class RotateCamera extends Phaser.Scene { private cursors!: Phaser.Types.Input.Keyboard.CursorKeys private keys!: WASDKeys priva...
ourcade/phaser3-typescript-examples
src/audio/html5-audio/seek/Seek.ts
<reponame>ourcade/phaser3-typescript-examples<gh_stars>10-100 import Phaser from 'phaser' import dat from 'dat.gui' export default class Seek extends Phaser.Scene { private catAstroPhi!: Phaser.Sound.HTML5AudioSound private rainbowMask!: Phaser.GameObjects.Graphics private cat!: Phaser.GameObjects.Sprite preload...
ourcade/phaser3-typescript-examples
src/actions/place-on-rectangle-shift/PlaceOnRectangleShift.ts
<reponame>ourcade/phaser3-typescript-examples<filename>src/actions/place-on-rectangle-shift/PlaceOnRectangleShift.ts import Phaser from 'phaser' export default class PlaceOnRectangleShift extends Phaser.Scene { private rect!: Phaser.Geom.Rectangle private group!: Phaser.GameObjects.Group private counter = 0 prel...
ourcade/phaser3-typescript-examples
src/animation/on-complete-callback/OnCompleteCallback.ts
import Phaser from 'phaser' export default class OnCompleteCallback extends Phaser.Scene { private gem!: Phaser.GameObjects.Sprite preload() { this.load.atlas('gems','/assets/tests/columns/gems.png','/assets/tests/columns/gems.json') } create() { const animConfig: Phaser.Types.Animations.Animation = { k...
ourcade/phaser3-typescript-examples
src/audio/html5-audio/basic-playback-and-events/BasicPlaybackAndEvents.ts
import Phaser from 'phaser' import createTests from './Tests' import WebFontFile from './WebFontFile' export default class BasicPlaybackAndEvents extends Phaser.Scene { private text!: Phaser.GameObjects.Text private tests: ((fn: () => void) => void)[] = [] preload() { this.load.addFile(new WebFontFile(this.loa...
ourcade/phaser3-typescript-examples
src/camera/world-coordinate-from-another-scene/WorldScene.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class WorldScene extends Phaser.Scene { constructor() { super('world') } preload() { this.load.image('map', '/assets/tests/camera/earthbound-scarab.png') } create() { this.cameras.main.setBounds(0, 0, 1024, 2048) ...
ourcade/phaser3-typescript-examples
src/camera/ignore/Ignore.ts
import Phaser from 'phaser' export default class Ignore extends Phaser.Scene { private uiText1!: Phaser.GameObjects.Text private uiText2!: Phaser.GameObjects.Text preload() { this.load.image('einstein', '/assets/pics/ra-einstein.png') } create() { const image = this.add.image(400, 300, 'einstein') this...
ourcade/phaser3-typescript-examples
src/animation/create-animation-from-canvas-texture/main.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' import CreateAnimationFromCanvasTexture from './CreateAnimationFromCanvasTexture' const config: Phaser.Types.Core.GameConfig = { type: Phaser.CANVAS, width: 800, height: 600, backgroundColor: '#2d2d2d', parent: 'phaser-examp...
ourcade/phaser3-typescript-examples
src/audio/web-audio/play-audio-from-child-scene/SceneA.ts
<filename>src/audio/web-audio/play-audio-from-child-scene/SceneA.ts<gh_stars>10-100 import Phaser from 'phaser' export default class SceneA extends Phaser.Scene { constructor() { super('sceneA') } preload() { this.load.audio('jungle', [ '/assets/audio/jungle.ogg', '/assets/audio/jungl...
ourcade/phaser3-typescript-examples
src/camera/cross-scene-object-placement/UIScene.ts
<filename>src/camera/cross-scene-object-placement/UIScene.ts import Phaser from 'phaser' import ILocationScene from './ILocationScene' export default class UIScene extends Phaser.Scene { private mapScene!: Phaser.Scene & ILocationScene private mapCamera!: Phaser.Cameras.Scene2D.Camera private graphics!: Phaser.Ga...
ourcade/phaser3-typescript-examples
src/animation/single-sprite-sheet/SingleSpriteSheet.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class SingleSpriteSheet extends Phaser.Scene { preload() { this.load.spritesheet('boom','/assets/sprites/explosion.png', { frameWidth: 64, frameHeight: 64, endFrame: 23 }) } create() { this.anims.create({ key: 'explode', frames: this.anims.gen...
ourcade/phaser3-typescript-examples
src/actions/place-on-rectangle/PlaceOnRectangle.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class PlaceOnRectangle extends Phaser.Scene { preload() { this.load.image('ball','/assets/sprites/shinyball.png') } create() { const rect = new Phaser.Geom.Rectangle(100, 100, 256, 256) const group = this.add.group() ...
ourcade/phaser3-typescript-examples
src/camera/16-camera-shader-test/CustomPipeline1.ts
import Phaser from 'phaser' export default class CustomPipeline1 extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline { constructor(game: Phaser.Game) { super({ game: game, renderer: game.renderer, fragShader: [ "precision mediump float;", "uniform float time...
ourcade/phaser3-typescript-examples
src/camera/camera-effects/CameraEffects.ts
<filename>src/camera/camera-effects/CameraEffects.ts<gh_stars>10-100 import Phaser from 'phaser' export default class CameraEffects extends Phaser.Scene { private fadeCamera!: Phaser.Cameras.Scene2D.Camera private flashCamera!: Phaser.Cameras.Scene2D.Camera private shakeCamera!: Phaser.Cameras.Scene2D.Camera prel...
ourcade/phaser3-typescript-examples
src/camera/follow-sprite-small-bounds/FollowSpriteSmallBounds.ts
<filename>src/camera/follow-sprite-small-bounds/FollowSpriteSmallBounds.ts import Phaser from 'phaser' export default class FollowSpriteSmallBounds extends Phaser.Scene { private player!: Phaser.Physics.Arcade.Image private cursors!: Phaser.Types.Input.Keyboard.CursorKeys preload() { this.load.image('bg', '/ass...
ourcade/phaser3-typescript-examples
src/camera/shader-multi-cam-test/main.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' import ShaderMultiCamTest from './ShaderMultiCamTest' const config: Phaser.Types.Core.GameConfig = { type: Phaser.AUTO, width: 1024, height: 512, parent: 'phaser-example', scene: [ShaderMultiCamTest], scale: { mode: Phase...
ourcade/phaser3-typescript-examples
src/actions/place-on-triangle/PlaceOnTriangle.ts
<filename>src/actions/place-on-triangle/PlaceOnTriangle.ts<gh_stars>10-100 import Phaser from 'phaser' export default class PlaceOnTriangle extends Phaser.Scene { preload() { this.load.image('ball','/assets/sprites/chunk.png') } create() { const triangle = this.createTriangle('right') var group = this.add...
ourcade/phaser3-typescript-examples
src/animation/scaled-animation/ScaledAnimation.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class ScaledAnimation extends Phaser.Scene { preload() { this.load.atlas('gems','/assets/animations/diamond.png','/assets/animations/diamond.json') } create() { this.anims.create({ key: 'diamond', frames: this.anims.generateFrameNames('gems', { pref...
ourcade/phaser3-typescript-examples
src/camera/single-small-camera/Test5.ts
import Phaser from 'phaser' export default class Test5 extends Phaser.Scene { constructor() { super('test-5') } create() { // In the middle this.add.image(400, 300, 'pic') // Why isn't this cropped? this.add.image(400, 300, 'vulkaiser').setScale(4).setAlpha(0.3) // In the corners this.add.ima...
ourcade/phaser3-typescript-examples
src/animation/all-frames-texture-atlas-animation/AllFramesTextureAtlasAnimation.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class AllFramesTextureAtlasAnimation extends Phaser.Scene { preload() { this.load.atlas('gems','/assets/tests/columns/gems.png','/assets/tests/columns/gems.json') } create() { this.anims.create({ key: 'everything', frames: this.anims.generateFrameNa...
ourcade/phaser3-typescript-examples
src/camera/set-small-bounds/SetSmallBounds.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class SetSmallBounds extends Phaser.Scene { private controls!: Phaser.Cameras.Controls.SmoothedKeyControl preload() { this.load.image('pic', '/assets/pics/lazur-skkaay3.png') } create() { this.add.image(0, 200, 'pic')....
ourcade/phaser3-typescript-examples
src/depth-sorting/isometric-blocks/IsometricBlocks.ts
import Phaser from 'phaser' export default class IsometricBlocks extends Phaser.Scene { private controls!: Phaser.Cameras.Controls.SmoothedKeyControl preload() { this.load.atlas('isoblocks', '/assets/atlas/isoblocks.png', '/assets/atlas/isoblocks.json') } create() { this.textures.get('isoblocks').getFrameN...
ourcade/phaser3-typescript-examples
src/actions/place-on-ellipse/PlaceOnEllipse.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class PlaceOnEllipse extends Phaser.Scene { private ellipse!: Phaser.Geom.Ellipse private group!: Phaser.GameObjects.Group preload() { this.load.image('ball','/assets/sprites/shinyball.png') } create() { this.ellipse ...
ourcade/phaser3-typescript-examples
src/camera/single-small-camera/Test3.ts
import Phaser from 'phaser' export default class Test3 extends Phaser.Scene { constructor() { super('test-3') } create() { // In the middle this.add.image(400, 300, 'pic') // Why isn't this cropped? this.add.image(400, 300, 'vulkaiser').setScale(4).setAlpha(0.3) // In the corners this.add.ima...
ourcade/phaser3-typescript-examples
src/audio/html5-audio/volume-mute-rate-detune/VolumeMuteRateDetune.ts
<filename>src/audio/html5-audio/volume-mute-rate-detune/VolumeMuteRateDetune.ts import Phaser from 'phaser' import dat from 'dat.gui' const horseFrames: { key: string, frame: string }[] = [] for (let i = 0; i < 12; i++) { horseFrames.push({ key: `horse${`0${i}`.slice(-2)}`, frame: '__BASE' })...
ourcade/phaser3-typescript-examples
src/camera/render-to-texture-shader-4/CustomPipeline.ts
<reponame>ourcade/phaser3-typescript-examples<gh_stars>10-100 import Phaser from 'phaser' export default class CustomPipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline { constructor(game: Phaser.Game) { super({ game: game, renderer: game.renderer, fragShader: [...
ourcade/phaser3-typescript-examples
src/actions/place-on-line/PlaceOnLine.ts
import Phaser from 'phaser' export default class PlaceOnLine extends Phaser.Scene { preload() { this.load.image('ball','/assets/sprites/shinyball.png') } create() { const line = new Phaser.Geom.Line(100, 200, 600, 400) const group = this.add.group() group.createMultiple({ key: 'ball', frameQuantity: 32 ...
ourcade/phaser3-typescript-examples
src/actions/set-alpha/SetAlpha.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class SetAlpha extends Phaser.Scene { preload() { this.load.spritesheet('diamonds','/assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 }) } create() { const group = this.add.group() group.createMultiple({ key: 'diamonds', ...
ourcade/phaser3-typescript-examples
src/actions/set-xy/SetXy.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class SetXy extends Phaser.Scene { preload() { this.load.image('phaser','/assets/sprites/phaser2.png') } create() { const group = this.add.group() // Add an existing Image into the group: const image = this.add.image(0, 0, 'phaser') group.a...
ourcade/phaser3-typescript-examples
src/actions/random-triangle/RandomTriangle.ts
import Phaser from 'phaser' export default class RandomTriangle extends Phaser.Scene { preload() { this.load.image('orb','/assets/sprites/orb-blue.png') } create() { // Create 300 sprites (they all start life at 0x0) const group = this.add.group() group.createMultiple({ key: 'orb', frameQuantity: 300 })...
ourcade/phaser3-typescript-examples
src/components/data/query-data/QueryData.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class QueryData extends Phaser.Scene { preload() { this.load.image('gem', '/assets/sprites/gem.png') } create() { const image = this.add.image(400, 100, 'gem') image.setDataEnabled() image.data.set('name', 'Red GemStone') image.data.set('val...
ourcade/phaser3-typescript-examples
src/depth-sorting/get-top-object/GetTopObject.ts
<filename>src/depth-sorting/get-top-object/GetTopObject.ts import Phaser from 'phaser' export default class GetTopObject extends Phaser.Scene { private message!: Phaser.GameObjects.Text preload() { this.load.atlas('atlas', '/assets/atlas/megaset-3.png', '/assets/atlas/megaset-3.json') } create() { // Crea...
ourcade/phaser3-typescript-examples
src/camera/cross-scene-object-placement/MapScene.ts
<gh_stars>10-100 import Phaser from 'phaser' import ILocationScene from './ILocationScene' export default class MapScene extends Phaser.Scene implements ILocationScene { location1: Phaser.Math.Vector2 location2: Phaser.Math.Vector2 location3: Phaser.Math.Vector2 location4: Phaser.Math.Vector2 location5: Phaser.M...
ourcade/phaser3-typescript-examples
src/audio/web-audio/reuse-audio-context/main.ts
import Phaser from 'phaser' import config from './config' import ReuseAudioContext from './ReuseAudioContext' config.scene = [ReuseAudioContext] export default new Phaser.Game(config)
ourcade/phaser3-typescript-examples
src/camera/single-small-camera/Test2.ts
import Phaser from 'phaser' export default class Test2 extends Phaser.Scene { constructor() { super('test-2') } create() { // In the middle this.add.image(400, 300, 'pic') // Why isn't this cropped? this.add.image(400, 300, 'vulkaiser').setScale(4).setAlpha(0.3) // In the corners this.add.ima...
ourcade/phaser3-typescript-examples
src/actions/shift-position/ShiftPosition.ts
import Phaser from 'phaser' export default class ShiftPosition extends Phaser.Scene { private group!: Phaser.GameObjects.Group private x = 0 private y = 0 private move = 0 preload() { this.load.image('sky','/assets/skies/deepblue.png') this.load.image('ball','/assets/demoscene/ball-tlb.png') } creat...
ourcade/phaser3-typescript-examples
src/actions/grid-align/GridAlign.ts
<filename>src/actions/grid-align/GridAlign.ts import Phaser from 'phaser' export default class GridAlign extends Phaser.Scene { preload() { this.load.spritesheet('diamonds', '/assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 }); } create() { const group = this.add.group() group.creat...
ourcade/phaser3-typescript-examples
src/camera/basics/Basics.ts
import Phaser from 'phaser' import dat from 'dat.gui' export default class Basics extends Phaser.Scene { preload() { this.load.image('robot','/assets/pics/robota-uxo-by-made-of-bomb.jpg') } create() { const gui = new dat.GUI() // Our image is 1920 x 989. // Our game canvas is 800 x 600. this.add.im...
ourcade/phaser3-typescript-examples
src/depth-sorting/remove-from-display-list/RemoveFromDisplayList.ts
import Phaser from 'phaser' export default class RemoveFromDisplayList extends Phaser.Scene { private timerEvent!: Phaser.Time.TimerEvent preload() { this.load.spritesheet('diamonds', '/assets/sprites/diamonds32x5.png', { frameWidth: 64 }) } create() { // Create 108 sprites in a grid so we can see them va...
ourcade/phaser3-typescript-examples
src/animation/on-start-callback/OnStartCallback.ts
<reponame>ourcade/phaser3-typescript-examples<filename>src/animation/on-start-callback/OnStartCallback.ts import Phaser from 'phaser' export default class OnStartCallback extends Phaser.Scene { preload() { this.load.atlas('gems','/assets/tests/columns/gems.png','/assets/tests/columns/gems.json') } create() { ...
ourcade/phaser3-typescript-examples
src/audio/html5-audio/play-audio-from-child-scene/SceneB.ts
<reponame>ourcade/phaser3-typescript-examples<gh_stars>10-100 import Phaser from 'phaser' export default class SceneB extends Phaser.Scene { constructor() { super('sceneB') } preload() { this.load.audio('theme', [ '/assets/audio/oedipus_wizball_highscore.ogg', '/assets/audio/oedipus_w...
ourcade/phaser3-typescript-examples
src/depth-sorting/3d-depth-sort/DepthSort3D.ts
<filename>src/depth-sorting/3d-depth-sort/DepthSort3D.ts import Phaser from 'phaser' import parseObj from './parseObj' import { rotateX3D, rotateY3D, rotateZ3D } from './utils' import IModel from './IModel' const t = { x: -0.003490658503988659, y: 0.003490658503988659, z: -0.003490658503988659 } expo...
ourcade/phaser3-typescript-examples
src/camera/follow-sprite-with-deadzone/FollowSpriteWithDeadzone.ts
<reponame>ourcade/phaser3-typescript-examples<filename>src/camera/follow-sprite-with-deadzone/FollowSpriteWithDeadzone.ts import Phaser from 'phaser' export default class FollowSpriteWithDeadzone extends Phaser.Scene { private player!: Phaser.Physics.Arcade.Image private graphics!: Phaser.GameObjects.Graphics priva...
ourcade/phaser3-typescript-examples
src/animation/generate-frames/GenerateFrames.ts
<gh_stars>10-100 import Phaser from 'phaser' export default class GenerateFrames extends Phaser.Scene { preload() { this.load.spritesheet('boom','/assets/sprites/explosion.png', { frameWidth: 64, frameHeight: 64, endFrame: 23 }) } create() { const config: Phaser.Types.Animations.Animation = { key: 'explod...
ourcade/phaser3-typescript-examples
src/camera/camera-blur-shader/CustomPipeline.ts
import Phaser from 'phaser' export default class CustomPipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline { constructor(game: Phaser.Game) { super({ game: game, renderer: game.renderer, fragShader: [ "precision mediump float;", //"in" attributes from our vertex shader "varyi...
ourcade/phaser3-typescript-examples
src/camera/camera-fade-in-and-out/CameraFadeInAndOut.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class CameraFadeInAndOut extends Phaser.Scene { preload() { this.load.image('robota','/assets/pics/robota-uxo-by-made-of-bomb.jpg') } create() { const image = this.add.image(900, 300, 'robota') this.tweens.add({ ta...
ourcade/phaser3-typescript-examples
src/animation/stagger-play/StaggerPlay.ts
import Phaser from 'phaser' export default class StaggerPlay extends Phaser.Scene { preload() { this.load.spritesheet('diamonds','/assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 }) } create() { this.anims.create({ key: 'flash', frames: this.anims.generateFrameNumbers('diamonds',...
ourcade/phaser3-typescript-examples
src/camera/world-coordinate-from-another-scene/UIScene.ts
import Phaser from 'phaser' export default class UIScene extends Phaser.Scene { constructor() { super('ui') } create() { var text = this.add.text(10, 10, 'Click to move') text.setShadow(1, 1, '#000000', 2) const worldCamera = this.scene.get('world').cameras.main this.input.on(Phase...
ourcade/phaser3-typescript-examples
src/camera/render-to-texture-canvas/RenderToTextureCanvas.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class RenderToTextureCanvas extends Phaser.Scene { preload() { this.load.image('volcano', '/assets/pics/the-end-by-iloe-and-made.jpg') this.load.image('hotdog', '/assets/sprites/hotdog.png') this.load.image('logo', '/asset...
ourcade/phaser3-typescript-examples
src/animation/create-animation-from-canvas-texture/CreateAnimationFromCanvasTexture.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class CreateAnimationFromCanvasTexture extends Phaser.Scene { create() { const framesPerRow = 8 const frameTotal = 32 // Create a CanvasTexture that is 256 x 128 in size. // The frames will be 32 x 32, which means we'...
ourcade/phaser3-typescript-examples
src/components/data/store-scene-data/StoreSceneData.ts
<filename>src/components/data/store-scene-data/StoreSceneData.ts import Phaser from 'phaser' export default class StoreSceneData extends Phaser.Scene { create() { // Using the Scene Data Plugin we can store data on a Scene level this.data.set('lives', 3) this.data.set('level', 5) this.data.set('score', 2000...
ourcade/phaser3-typescript-examples
src/audio/web-audio/loop-delay/LoopDelay.ts
import Phaser from 'phaser' import dat from 'dat.gui' export default class LoopDelay extends Phaser.Scene { private topLeftSpeaker!: Phaser.GameObjects.Image private topRightSpeaker!: Phaser.GameObjects.Image private middleSpeaker!: Phaser.GameObjects.Image private bottomSpeaker!: Phaser.GameObjects.Image priva...
ourcade/phaser3-typescript-examples
src/camera/camera-filter/CameraFilter.ts
import Phaser from 'phaser' export default class CameraFilter extends Phaser.Scene { private camlist: Phaser.Cameras.Scene2D.Camera[] = [] private text1!: Phaser.GameObjects.Text private text2!: Phaser.GameObjects.Text private text3!: Phaser.GameObjects.Text private uiCam1!: Phaser.Cameras.Scene2D.Camera priva...
ourcade/phaser3-typescript-examples
src/camera/change-camera-shader/ChangeCameraShader.ts
import Phaser from 'phaser' import CustomPipeline1 from './CustomPipeline1' import CustomPipeline2 from './CustomPipeline2' export default class ChangeCameraShader extends Phaser.Scene { private customPipeline1!: Phaser.Renderer.WebGL.WebGLPipeline private customPipeline2!: Phaser.Renderer.WebGL.WebGLPipeline pri...
ourcade/phaser3-typescript-examples
src/camera/add-and-remove-test/AddAndRemoveTest.ts
import Phaser from 'phaser' export default class AddAndRemoveTest extends Phaser.Scene { private flashCamera!: Phaser.Cameras.Scene2D.Camera private shakeCamera!: Phaser.Cameras.Scene2D.Camera private camerasAdded: Phaser.Cameras.Scene2D.Camera[] = [] private camerasRemoved: Phaser.Cameras.Scene2D.Camera[] = [] ...
ourcade/phaser3-typescript-examples
src/actions/wrap-in-rectangle/WrapInRectangle.ts
import Phaser from 'phaser' export default class WrapInRectangle extends Phaser.Scene { private rect!: Phaser.Geom.Rectangle private group!: Phaser.GameObjects.Group preload() { this.load.image('ball','/assets/sprites/shinyball.png') } create() { this.rect = new Phaser.Geom.Rectangle(100, 100, 256, 256) ...
ourcade/phaser3-typescript-examples
src/animation/animation-repeat-event/AnimationRepeatEvent.ts
<reponame>ourcade/phaser3-typescript-examples import Phaser from 'phaser' export default class AnimationRepeatEvent extends Phaser.Scene { preload() { this.load.image('poo','/assets/sprites/poo.png'); this.load.spritesheet('mummy','/assets/animations/mummy37x45.png', { frameWidth: 37, frameHeight: 45 }) } ...
jnabor/ga2-serverless
src/dashboard/Dashboard.tsx
<reponame>jnabor/ga2-serverless<gh_stars>1-10 import React, { useContext, useEffect } from 'react' import { useHistory } from 'react-router-dom' import clsx from 'clsx' import { Drawer, CssBaseline, Toolbar, AppBar, List, Typography, Divider, Container, IconButton, Paper, Grid, Button } from '@m...
littlebtc/covid-footprints-tw
index.ts
<reponame>littlebtc/covid-footprints-tw import { ApiKey } from "@esri/arcgis-rest-auth" import { bulkGeocode } from "@esri/arcgis-rest-geocoding" import Airtable from "airtable" import fetch from "node-fetch" import FormData from "isomorphic-form-data" declare global { namespace NodeJS { interface Global { ...
littlebtc/covid-footprints-tw
dump.ts
<gh_stars>0 import { promises } from "fs" import Airtable from "airtable" import { FeatureCollection } from "geojson" const base = new Airtable().base(process.env.AIRTABLE_BASE_ID ?? "") const records = await base("data").select({ view: "Grid view" }).all() const result: FeatureCollection = { type: "FeatureCollectio...
pittst3r/chromedriver
example/bigtest/test/index.test.ts
import { test } from '@bigtest/suite'; import { App, Heading } from '@bigtest/interactor'; export default test("foo") .step(App.visit("/")) .assertion(Heading("Hello world").exists());
eduardodsaraujo/meat-app
src/app/restaurants/restaurants.component.ts
import { Component, OnInit } from '@angular/core'; import { Restaurant } from './restaurant/restaurant.model'; import { RestaurantService } from './restaurants.service'; @Component({ selector: 'mt-restaurants', templateUrl: './restaurants.component.html' }) export class RestaurantsComponent implements OnInit { ...
eduardodsaraujo/meat-app
src/app/restaurants/restaurants.service.ts
import { Restaurant } from "./restaurant/restaurant.model"; import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import { MEAT_API } from "app.api"; import { Observable } from "rxjs/Observable"; import "rxjs/add/operator/map"; import "rxjs/add/operator/catch"; import { ErrorHandler } from "...
eduardodsaraujo/meat-app
src/app/restaurants/restaurant-detail/restaurant-detail.component.ts
<reponame>eduardodsaraujo/meat-app import { Component, OnInit } from '@angular/core'; import { RestaurantService } from '../restaurants.service'; import { Restaurant } from '../restaurant/restaurant.model'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'mt-restaurant-detail', templateUrl...
MGsus/MEANMarbles
client/app/login/login.component.ts
import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators, FormControl } from "@angular/forms"; import { Router } from "@angular/router"; import { AuthService } from "../services/auth/auth.service"; @Component({ selector: "app-login", templateUrl: "./login.component.ht...
MGsus/MEANMarbles
server/controller/adminCtrl.ts
import baseCtrl from "./baseCtrl"; import admin from "../models/admin"; export default class adminCtrl extends baseCtrl { model = admin; login = function(req: any, res: any) { try { let out = this.model.findOne({ nickname: req.body.nickname }); res.status(200).json(out.nickname); } catch (erro...
MGsus/MEANMarbles
server/controller/baseCtrl.ts
<filename>server/controller/baseCtrl.ts<gh_stars>0 abstract class baseCtrl { abstract model: any; getAll = async (req: any, res: any) => { try { let docs = await this.model.find({}); res.status(200).json(docs); } catch (err) { return res.status(400).json({ error: err.message }); } }...
MGsus/MEANMarbles
client/app/shared/interfaces/pool.interface.ts
export interface IPool { _id?: string; code?: number; date?: any; totalPeople: number; marbles: number; results: any; }
MGsus/MEANMarbles
server/models/admin.ts
<gh_stars>0 import * as mongoose from "mongoose"; const adminSchema = new mongoose.Schema({ nickname: String, code: String }); const admin = mongoose.model('admin', adminSchema); export default admin;
MGsus/MEANMarbles
server/app.ts
<filename>server/app.ts import * as express from "express"; import * as path from "path"; import * as bodyParser from "body-parser"; import * as cors from "cors"; import * as mongoose from "mongoose"; import setRoutes from "./routes/router"; import * as morgan from "morgan"; let app = express(); app.use(bodyParser.js...
MGsus/MEANMarbles
server/controller/userCtrl.ts
import baseCtrl from "./baseCtrl"; import user from "../models/user"; import poolCtrl from "./poolCtrl"; export default class userCtrl extends baseCtrl { model = user; login = async function(req: any, res: any) { try { const nwUser = new user(); nwUser.nickname = req.body.nickname; await nwU...
MGsus/MEANMarbles
client/app/shared/interfaces/admin.interface.ts
<gh_stars>0 export interface IAdmin { _id?: string; nickname?: string; }
MGsus/MEANMarbles
client/app/services/auth/auth.service.ts
import { Injectable } from "@angular/core"; import { Router } from "@angular/router"; import { UserService } from "../user/user.service"; import { IUser } from "../../shared/interfaces/user.interface"; import "rxjs/add/operator/map"; @Injectable() export class AuthService { loggedIn = false; isAdmin = false; c...
MGsus/MEANMarbles
server/models/pool.ts
import * as mongoose from "mongoose"; const resultSchema = new mongoose.Schema({ user: String, redMarbles: Number, greenMarbles: Number }); const poolSchema = new mongoose.Schema({ code: String, date: Date, totalPeople: Number, marbles: Number, results: [resultSchema] }); const pool = mongoose.model(...
MGsus/MEANMarbles
server/controller/poolCtrl.ts
import pool from "../models/pool"; import baseCtrl from "./baseCtrl"; import * as bcrypt from "bcrypt"; export default class poolCtrl extends baseCtrl { model = pool; newPool = function(req: any, res: any) { let { totalPeople: _totalPpl, marbles: _marbles } = req.body; bcrypt.genSalt(5, function(err: any...
MGsus/MEANMarbles
server/routes/router.ts
<gh_stars>0 import * as express from "express"; import UserCtrl from "../controller/userCtrl"; import AdminCtrl from "../controller/adminCtrl"; import PoolCtrl from "../controller/poolCtrl"; export default function setRoutes(app: any) { const router = express.Router(); const userCtrl = new UserCtrl(); const adm...
MGsus/MEANMarbles
client/app/app.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core"; import { AppRoutingModule } from "./app-routing.module"; import { SharedModule } from "./shared/shared.module"; import { AppComponent } from "./app.component"; import { LoginComponent } from "./login/login.component"; import { AdminComponent } from "./...
MGsus/MEANMarbles
server/models/user.ts
<reponame>MGsus/MEANMarbles<gh_stars>0 import * as mongoose from "mongoose"; const userSchema = new mongoose.Schema({ nickname: { type: String, unique: true } }); const user = mongoose.model("user", userSchema); export default user;
MGsus/MEANMarbles
client/app/shared/interfaces/user.interface.ts
<reponame>MGsus/MEANMarbles<gh_stars>0 export class IUser { _id?: string; nickname?: string; role?: string; }
MGsus/MEANMarbles
client/app/services/user/user.service.ts
import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; import { IUser } from "../../shared/interfaces/user.interface"; @Injectable() export class UserService { constructor(private http: HttpClient) {} login(nickname: any): Observable<any>...
MGsus/MEANMarbles
client/app/services/admin/admin.service.ts
import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; import { IPool } from "../../shared/interfaces/pool.interface"; @Injectable() export class AdminService { constructor(private http: HttpClient) {} login(nickname: any): Observable<any...
barouchmaximedenoun/similarweb
server/src/types.ts
export interface VideoSharedMessage { title: string; videoId: string; }
barouchmaximedenoun/similarweb
server/src/VideoSharedMsgServer.ts
<reponame>barouchmaximedenoun/similarweb<gh_stars>0 import Socket from 'socket.io'; import { VideoSharedMsgEvent } from './constants'; import { VideoSharedMessage } from './types'; import { Server } from 'http'; export class VideoSharedMsgServer { private io: Socket.Server; private videos: VideoSharedMessage[] = [...
barouchmaximedenoun/similarweb
src/components/VideoSearch.test.tsx
import React from 'react'; import VideoSearch, { GOOGLE_AUTOCOMPLETE_URL } from './VideoSearch'; import {render as rtlRender, screen, fireEvent} from '@testing-library/react' import { rest } from 'msw'; import { setupServer } from 'msw/node'; const server = setupServer( rest.get(GOOGLE_AUTOCOMPLETE_URL, (req:any, re...
barouchmaximedenoun/similarweb
server/src/index.ts
<filename>server/src/index.ts import './Server';
barouchmaximedenoun/similarweb
server/src/constants.ts
export enum VideoSharedMsgEvent { CONNECT = 'connect', DISCONNECT = 'disconnect', ADD_VIDEO_MESSAGE = 'add-video', ADDED_VIDEO_MESSAGE = 'added-video', REMOVE_VIDEO_MESSAGE = 'remove-video', REMOVED_VIDEO_MESSAGE = 'removed-video', END_VIDEO_MESSAGE = 'end-video' }