Skip to content

Instantly share code, notes, and snippets.

@rightfold
Last active August 29, 2015 14:01
Show Gist options
  • Save rightfold/151adf0fc779f7aa4b39 to your computer and use it in GitHub Desktop.
Save rightfold/151adf0fc779f7aa4b39 to your computer and use it in GitHub Desktop.
var mooon = angular.module('mooon', []);
mooon.controller('MapController', function($scope) {
$scope.bodies = [
{radius: 14, x: 90, y: 90},
{radius: 4, x: 80, y: 80}
];
requestAnimationFrame(function updateMap(time) {
requestAnimationFrame(updateMap);
$scope.bodies[1].x = $scope.bodies[0].x + 30 * Math.cos(time / 300);
$scope.bodies[1].y = $scope.bodies[0].y + 30 * Math.sin(time / 300);
$scope.$apply();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment