mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
working paralax (not for zoom)
This commit is contained in:
parent
357ef181d9
commit
85867f92af
10 changed files with 117 additions and 15 deletions
|
|
@ -4,9 +4,17 @@ define([
|
|||
|
||||
function (Abstract) {
|
||||
|
||||
function Layer(name, z, parallaxSpeed) {
|
||||
function Layer(name, parallaxSpeed) {
|
||||
this.name = name;
|
||||
this.parallaxSpeed = parallaxSpeed;
|
||||
this.zoom = {
|
||||
current: 1,
|
||||
target: 1
|
||||
};
|
||||
this.position = {
|
||||
current: { x: 0, y: 0},
|
||||
target: { x: 0, y: 0}
|
||||
};
|
||||
}
|
||||
|
||||
Object.defineProperty(Layer, 'ID', {
|
||||
|
|
@ -24,10 +32,20 @@ function (Abstract) {
|
|||
Abstract.prototype.addMethod.call(Layer, 'addMesh', ['mesh']);
|
||||
Abstract.prototype.addMethod.call(Layer, 'removeMesh', ['mesh']);
|
||||
Abstract.prototype.addMethod.call(Layer, 'updateMesh', ['mesh', 'options']);
|
||||
Abstract.prototype.addMethod.call(Layer, 'render', ['centerPosition']);
|
||||
|
||||
Layer.prototype.getName = function() {
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Layer.prototype.setPosition = function(centerPosition) {
|
||||
this.position.target.x = centerPosition.x;
|
||||
this.position.target.y = centerPosition.y;
|
||||
};
|
||||
|
||||
Layer.prototype.setZoom = function(z) {
|
||||
this.zoom.target = z;
|
||||
};
|
||||
|
||||
return Layer;
|
||||
});
|
||||
|
|
@ -64,7 +64,7 @@ function (Abstract, DomController, Settings, Exception, Nc) {
|
|||
AbstractView.prototype.setMe = function(player) {
|
||||
this.me = player;
|
||||
};
|
||||
|
||||
/*
|
||||
AbstractView.prototype.calculateCameraPosition = function() {
|
||||
var reference = this.me.getPosition();
|
||||
var pos = {};
|
||||
|
|
@ -80,7 +80,7 @@ function (Abstract, DomController, Settings, Exception, Nc) {
|
|||
|
||||
return pos;
|
||||
};
|
||||
|
||||
*/
|
||||
AbstractView.prototype.onFullscreenChange = function(isFullScreen) {
|
||||
|
||||
if (!isFullScreen) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue