fable-compiler / samples-pixi

Pixi samples for Fable
http://fable.io/samples-pixi/
Apache License 2.0
17 stars 4 forks source link
animejs fable fsharp particles pixi-js pixi-particles pixi-samples pixijs

Samples-pixi

Libraries

Bindings & samples for Pixi.js related libraries including:

Pixi-particles

Pixi-Particles

Pixi-particles's really easy to use and there's a great online editor to configure your particle effects easily

Go to the src/particles folder to have a go. And make changes to the json located under public/img/emitter.json to see what you can do with particles.

Pixi-Sound

We also support Pixi-Sound, the official pixi sound API.

Go to the src/sound folder to see a sample in action.

Animatejs Tweening

Animejs

We support Animejs for all your tweenings!

Go to the src/animejs folder to see a sample in action.

Samples

We've got you covered with 19 straight to the point samples which are either ports from the PixiJS official ones or original ones.

Original samples

Dragon Particle

DragonParticle

Learn how to move a particle emitter around som SVG shape like our Fable Dragon!

You'll know how to:

Source code can be found here

Game of Cogs

Game of cogs

Learn how to make a complete mini game:

Source code can be found here

How to build and run the samples

Any modification you do to the F# code will be reflected in the web page after saving. If you want to write JS files to disk instead of using the development server, run dotnet fable yarn-build.

How to add a new sample

Webpack configuration

Pixi requires to set additional externals to work with webpack. Like this:

  externals: {
    "PIXI": "PIXI",
    "PIXI.extras": "PIXI.extras",
    "PIXI.loaders": "PIXI.loaders",
    "PIXI.settings": "PIXI.settings",
    "PIXI.filters": "PIXI.filters",
    "PIXI.interaction": "PIXI.interaction",
    "PIXI.mesh": "PIXI.mesh",
    "PIXI.particles": "PIXI.particles",
    "PIXI.sound": "PIXI.sound"
  },

Would you stumble on errors like this: Module not found: Error: Can't resolve 'PIXI.xxx' in ..., just add the module to the Webpack config.