<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
background: #202020;
}
div.rect {
width: 50px;
height: 50px;
background: yellow;
}
</style>
</head>
<body>
<div class="rect" id="rotate-rect"></div>
<script>
var rect = document.getElementById('rotate-rect');
var a = 1, b = 0, c = 0, d = 1, tx = 10, ty = 10, angle = 0, currentAngle;
function getAngleToRAD(){
if(angle === 360){
angle = 0;
}
return angle++ * Math.PI / 180;
}
function update(){
currentAngle = getAngleToRAD();
rect.style.transform = 'matrix(' + Math.cos(currentAngle) + ',' + Math.sin(currentAngle) + ',' + -Math.sin(currentAngle) + ',' + Math.cos(currentAngle) + ',' + tx + ',' + tx + ')'
window.requestAnimationFrame(update);
}
update();
</script>
</body>
</html>
npm cache clean
npm install
var ButtonFactory = (function(){
function ButtonFactory(){
}
ButtonFactory().prototype.getLikeButton = function(){
var likeButton = document.createElement('button');
likeButton.style.background = 'ff00ff';
likeButton.style.innerHTML = 'like';
return likeButton;
};
return ButtonFactory;
})();
var buttonFactory = new ButtonFactory();
document.getElementsByTagName('body')[0].appendChild(buttonFactory.getLikeButton());
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
<style type="text/css">
body {
background-color: #232323;
}
</style>
<script type="text/javascript">
var app = angular.module('CheckBoxApp', []);
app.controller('FilterController', ['$scope', function($scope){
$scope.filters = {id: 2};
$scope.allFilms = [
{ name: 'title 1', genre: 'horror', date: 2014 },
{ name: 'title 2', genre: 'comedy', date: 2015 },
{ name: 'title 3', genre: 'horror', date: 2014 },
{ name: 'title 4', genre: 'comedy', date: 2014 },
{ name: 'title 5', genre: 'horror', date: 2015 }
];
$scope.checkboxDataForFilter = {
range: '',
date: ''
};
}]);
</script>
</head>
<body>
<div ng-app="CheckBoxApp">
<div ng-controller="FilterController">
<label> all:
<input type="checkbox" ng-model="checkboxDataForFilter.genre" ng-true-value="''"/>
</label>
<label> horro:
<input type="checkbox" ng-model="checkboxDataForFilter.genre" ng-true-value="'horror'"/>
</label>
<label> comedy:
<input type="checkbox" ng-model="checkboxDataForFilter.genre" ng-true-value="'comedy'"/>
</label>
<br />
<label> all:
<input type="checkbox" ng-model="checkboxDataForFilter.date" ng-true-value="''"/>
</label>
<label> 2014:
<input type="checkbox" ng-model="checkboxDataForFilter.date" ng-true-value="2014"/>
</label>
<label> 2015:
<input type="checkbox" ng-model="checkboxDataForFilter.date" ng-true-value="2015"/>
</label>
<table>
<tr ng-repeat="item in allFilms | filter: { date: checkboxDataForFilter.date, genre: checkboxDataForFilter.genre }">
<td>Name: {{ item.name }},</td>
<td>Genre: {{ item.genre }},</td>
<td>Release Date: {{ item.date }}</td>
</tr>
</table>
</div>
</div>
</body>
</html>
var Snake = (function(){
function Snake(){
this.body = [];
this.score = 180;
this.gameTime = 0;
this.level = 0;
this.levelStep = 0;
}
return Snake;
})();
var snake = new Snake(); // у этого объекта свойства по умолчанию
...
...
snake = new Snake(); // теперь присваеваем свойству snake новый объект с свойствами по умолчанию
package
{
import flash.display.Sprite;
import flash.external.ExternalInterface;
public class Main extends Sprite
{
public function Main()
{
if (ExternalInterface.available)
{
ExternalInterface.call('alert', 'HelloWorld');
}
}
}
}
stop();
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.data.DataProvider;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.*;
var myXML: XML;
var dp: DataProvider;
var dg: DataGrid;
var urlReq: URLRequest;
var myLoader: URLLoader;
myXML = <response>
<table>
<name>2</name>
</table>
<links>
<xml>6</xml>
</links>
<users>
<user><id>1</id></user>
<user><id>3</id></user>
</users>
</response>;
var xml:XML = XML(myXML.users);
trace(xml)
var ids: DataGridColumn = new DataGridColumn("id");
ids.headerText = "id";
ids.width = 100;
dp = new DataProvider(xml);
dg = new DataGrid();
addChild(dg);
dg.x = 0;
dg.y = 0;
dg.width = 550;
dg.height = 454;
dg.headerHeight = 40;
dg.rowHeight = 30;
dg.columns = [ids];
dg.dataProvider = dp;
dg.rowCount = dp.length;
dg.setSize(550, 400);
var json = {
"stops" : [{
"zoneId":"5522bdb1e4b047df5b5b7afa",
"coords":[[
[49.25100320801442,28.541126489672024],
[49.25156346163994,28.542151093515713],
[49.25113626882619,28.542376399072964],
[49.25074759018555,28.541657567056973],
[49.25076509829823,28.54119622710641],
[49.25100320801442,28.541126489672024]
]],
"name":"Ватутина",
"description":""
}]
};
var polygonCoords = [];
var coords = json.stops[0].coords[0],
length = coords.length,
point,
POSITION_X = 0,
POSITION_Y = 1;
for(var i = 0; i < length; i++){
point = coords[i];
console.log(point[POSITION_X],point[POSITION_Y]);
// new google.maps.LatLng(point[POSITION_X],point[POSITION_Y]);
}
function initialize_map( ) {
var latlng = new google.maps.LatLng(info.stops[0].coords[0][0]);
var myOptions = {
zoom: 18,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var polygonCoords = [];
// ниже, я сохранил ссылку на json в свойство json,
// но как видно из Вашего кода, он у Вас называется info
// по этому я закоментирую свою строчку и оставлю Вашу.
// var coords = info.stops[0].coords[0],
var coords = info.stops[0].coords[0],
length = coords.length,
point,
POSITION_X = 0,
POSITION_Y = 1;
for(var i = 0; i < length; i++){
point = coords[i];
polygonCoords.push(new google.maps.LatLng(point[POSITION_X],point[POSITION_Y]));
}
var polygon = new google.maps.Polygon({
path: polygonCoords,
strokeColor: "#5196DB",
strokeOpacity: 1,
strokeWeight: 2,
fillColor: "#8ab9e7",
fillOpacity: 0.5
});
polygon.setMap(map);
return map;
}