All Projects → proyecto26 → Phaser Kinetic Scrolling Plugin

proyecto26 / Phaser Kinetic Scrolling Plugin

Licence: mit
Kinetic Scrolling plugin for Canvas using Phaser Framework

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to Phaser Kinetic Scrolling Plugin

Phaser3 Docs
Phaser 3 Documentation and TypeScript Defs
Stars: ✭ 339 (+189.74%)
Mutual labels:  phaser, phaserjs, webgl, html5
Creature webgl
2D Skeletal Animation WebGL Runtimes for Creature ( PixiJS, PhaserJS, ThreeJS, BabylonJS, Cocos Creator )
Stars: ✭ 140 (+19.66%)
Mutual labels:  phaser, webgl, pixijs, html5
Slither.io Clone
Learn how to make Slither.io with JavaScript and Phaser! This game clones all the core features of Slither.io, including mouse-following controls, snake collisions, food, snake growth, eyes, and more. Progress through each part of the source code with our Slither.io tutorial series.
Stars: ✭ 168 (+43.59%)
Mutual labels:  phaser, javascript-game, phaserjs
Gown.js
UI system for pixi.js inspired by feathers-ui
Stars: ✭ 195 (+66.67%)
Mutual labels:  webgl, html5-canvas, pixijs
Classic Pool Game
Classic 8 Ball pool game written in JavaScript
Stars: ✭ 177 (+51.28%)
Mutual labels:  javascript-game, html5-canvas, html5
Phaser
Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
Stars: ✭ 30,918 (+26325.64%)
Mutual labels:  phaser, phaserjs, webgl
Phaser State Transition
State transition plugin for Phaser.js
Stars: ✭ 169 (+44.44%)
Mutual labels:  phaser, phaserjs, pixijs
generator-phaser-browserify
A generator for Phaser using Gulp and Browserify
Stars: ✭ 36 (-69.23%)
Mutual labels:  gulp, phaser, phaserjs
Opensc2k
OpenSC2K - An Open Source remake of Sim City 2000 by Maxis
Stars: ✭ 4,753 (+3962.39%)
Mutual labels:  phaser, phaserjs, webgl
Foster Ts
A WebGL + TypeScript 2D Game framework with a Scene>Entity>Component model.
Stars: ✭ 112 (-4.27%)
Mutual labels:  webgl, html5-canvas, html5
Curtainsjs
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.
Stars: ✭ 1,039 (+788.03%)
Mutual labels:  webgl, html5
Phaser Node Kit
Rapid Game Development with PhaserJS and Node for Modern Browsers
Stars: ✭ 39 (-66.67%)
Mutual labels:  phaser, phaserjs
Playcanvas Spine
Plugin component for PlayCanvas which enables support for Spine animations.
Stars: ✭ 32 (-72.65%)
Mutual labels:  webgl, html5
Canvas101
Learning Canvas series
Stars: ✭ 28 (-76.07%)
Mutual labels:  html5-canvas, html5
Games
一个基于Phaser的小游戏集合
Stars: ✭ 1,167 (+897.44%)
Mutual labels:  phaser, html5
Easygameframeworkopen
基于Typescript的渐进式通用游戏前端开发框架
Stars: ✭ 65 (-44.44%)
Mutual labels:  phaser, pixijs
Icon Machine
Web application for randomly generating pixel art icons.
Stars: ✭ 73 (-37.61%)
Mutual labels:  html5-canvas, html5
Sketch Threejs
Interactive sketches made with three.js.
Stars: ✭ 1,227 (+948.72%)
Mutual labels:  gulp, webgl
Phaser3 Tilemap Pack
Phaser 3 Project Template with Webpack, Tilemap, and Asset Pack
Stars: ✭ 87 (-25.64%)
Mutual labels:  phaser, javascript-game
Bimserver Nodejs
OpenSouce BIMServer NodeJs
Stars: ✭ 28 (-76.07%)
Mutual labels:  webgl, html5

MIT license Current npm package version Maintenance Downloads Total downloads Follow @jdnichollsc

Kinetic Scrolling Plugin for Phaser Framework

Kinetic Scrolling Plugin

The vertical and horizontal scrolling is a very useful feature in the games for example to display a section of levels and with this plugin you can simulate the scrolling within a canvas element of HTML5... so check this awesome plugin for Phaser Framework!

Kinetic scrolling based on http://ariya.ofilabs.com/2013/11/javascript-kinetic-scrolling-part-2.html

Download the Plugin

NPM

Install via bower

bower i phaser-kinetic-scrolling-plugin --save

Install via npm

npm i phaser-kinetic-scrolling-plugin --save

Load the Plugin

this.game.kineticScrolling = this.game.plugins.add(Phaser.Plugin.KineticScrolling);

Change Default Settings of the Plugin - It isn't necessary, default is horizontal

this.game.kineticScrolling.configure({
    kineticMovement: true,
    timeConstantScroll: 325, //really mimic iOS
    horizontalScroll: true,
    verticalScroll: false,
    horizontalWheel: true,
    verticalWheel: false,
    deltaWheel: 40,
    onUpdate: null //A function to get the delta values if it's required (deltaX, deltaY)
});

Start the Plugin

this.game.kineticScrolling.start();

Stop the Plugin

this.game.kineticScrolling.stop();

Full Example

var game = new Phaser.Game(1024, 768, Phaser.AUTO, '', {
    init: function () {

        //Load the plugin
        this.game.kineticScrolling = this.game.plugins.add(Phaser.Plugin.KineticScrolling);

        //If you want change the default configuration before start the plugin
    },
    create: function () {

        //Starts the plugin
        this.game.kineticScrolling.start();

        //If you want change the default configuration after start the plugin

        this.rectangles = [];

        var initX = 50;

        for (var i = 0; i < 26; i++) {
            this.rectangles.push(this.createRectangle(initX, this.game.world.centerY - 100, 250, 200));
            this.index = this.game.add.text(initX + 125, this.game.world.centerY, i + 1,
                        { font: 'bold 150px Arial', align: "center" });
            this.index.anchor.set(0.5);
            initX += 300;
        }

        //Changing the world width
        this.game.world.setBounds(0, 0, 320 * this.rectangles.length, this.game.height);
    },
    createRectangle: function (x, y, w, h) {
        var sprite = this.game.add.graphics(x, y);
        sprite.beginFill(Phaser.Color.getRandomColor(100, 255), 1);
        sprite.bounds = new PIXI.Rectangle(0, 0, w, h);
        sprite.drawRect(0, 0, w, h);
        return sprite;
    }
});

Examples

The repository has some examples of the plugin, to run the examples created by the community execute the command gulp examples from the terminal:

  • Horizontal scrolling
  • Horizontal scrolling with scrollbar
  • Horizontal scrolling and pressing events
  • Horizontal and Vertical scrolling (Mouse wheel too)
  • onUpdate callback to track delta

Other Projects

Contributing ✨

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated ❤️.
You can learn more about how you can contribute to this project in the contribution guide.

Collaborators ✨

jdnichollsc daniel-mf VitaZheltyakov iamchristopher daaaabeen
Nicholls Daniel Vitaliy Chris Wright Daaaabeen

Supporting 🍻

I believe in Unicorns 🦄 Support me, if you do too.

License ⚖️

This repository is available under the MIT License.

Happy scrolling 💯

Made with <3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].