Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     //#region Shape
  2.     //Будющий конструктор
  3.     function Shape(windowWidth, windowHeight, shape) {
  4.         this.windowWidth = windowWidth;
  5.         this.windowHeight = windowHeight;
  6.         this.shape = shape;
  7.     };
  8.  
  9.     Shape.prototype = {
  10.         changeSizeOfShape : function () {
  11.             return Math.round(this.windowWidth / 10);
  12.         },
  13.         skidShape : function () {
  14.             return Math.ceil((this.changeSizeOfShape() * Math.sqrt(2) - this.changeSizeOfShape()) / 2);
  15.         },
  16.         shapePositionTop : function () {
  17.             return this.skidShape();
  18.         },
  19.         shapePositionBot : function () {
  20.             return this.windowHeight - (Math.ceil(this.changeSizeOfShape() * Math.sqrt(2)) - this.skidShape());
  21.         },
  22.         shapeStyle : function () {
  23.             shape.css({ "width": this.changeSizeOfShape() + "px", "height": this.changeSizeOfShape() + "px" });
  24.             shape.css("top", this.shapePositionTop() + "px");
  25.         }
  26.     };
  27.     //#endregion
  28.     //#region Comment Code
  29.     // function changeSizeOfFigure() {
  30.     //    var windowWidth = $(window).width();
  31.     //    var resultWidth = Math.round(windowWidth / 10);
  32.     //    shape.css({ "width": resultWidth + "px", "height": resultWidth + "px" });
  33.     //    return resultWidth;
  34.     // };
  35.     // changeSizeOfFigure();
  36.  
  37.     // //Определяем вынос нашего кварата(ромба)
  38.     // function skidShape() {
  39.     //    var side = changeSizeOfFigure();
  40.     //    return Math.ceil((side * Math.sqrt(2) - side) / 2);
  41.     // };
  42.     // skidShape();
  43.  
  44.     // function shapePositionBot() {
  45.     //    var side = skidShape();
  46.     //    return $(window).height() - (Math.ceil(changeSizeOfFigure() * Math.sqrt(2)) - side);
  47.     // };
  48.  
  49.     // function shapePositionTop() {
  50.     //    var position = skidShape();
  51.     //    shape.css("top", position + "px");
  52.     //    return position;
  53.     // };
  54.     // shapePositionTop();
  55.     //#endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement