Skip to content

Instantly share code, notes, and snippets.

@hyzhak
Last active December 17, 2015 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyzhak/5554410 to your computer and use it in GitHub Desktop.
Save hyzhak/5554410 to your computer and use it in GitHub Desktop.
Usage of ngCyclic module of darlingjs for simulate cyclic bacgrounds
var w = darlingjs.w('theCyclicWorld', ['ngCyclic']);
//add systems for implement cyclic behaviour
world.$add('ng2DCyclicLayer');
world.$add('ngMarkIfOutsideOfTheViewPortVertical2D');
world.$add('ngMarkIfOutsideOfTheViewPortHorizontal2D');
world.$add('ngMarkIfInsideOfTheViewPortVertical2D');
world.$add('ngMarkIfInsideOfTheViewPortHorizontal2D');
//add entity
world.$e('theEntity', {
ng2D: {
x: 10.0,
y: 10.0
},
ngCyclic: {
patternWidth: 1000,
patternHeight: 1000
}
});
//start simulation
world.$start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment