Blame view

controllets/animated-grid-controllet/animated-grid-controllet.html 5.8 KB
925d7edd   isisadmin   animated-grid-con...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  <!--

  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.

  This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt

  The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

  The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt

  Code distributed by Google as part of the polymer project is also

  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt

  -->

  <link rel="import" href="../../bower_components/polymer/polymer.html">

  <link rel="import" href="../../bower_components/paper-styles/paper-styles.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-shared-element-animatable-behavior.html">

  

  <dom-module id="animated-grid-controllet">

  

      <style>

  

          :host {

              display: block;

              /*background: #000;*/

          }

  

          /* clearfix */

          .grid:after

          {

              content: '';

              display: block;

              clear: both;

          }

  

          /* ---- grid-item ---- */

d0de5d86   isisadmin   public room
31
32
33
34
35
36
37
          ::content .grid-item {float: left;box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;border: 3px solid white;}

          ::content .grid-sizer {width: 200px;}

          ::content .grid-item-w20  {width:  200px;}

          ::content .grid-item-w40  {width:  400px;}

          ::content .grid-item-w60  {width:  600px;}

          ::content .grid-item-w80  {width:  80%;}

          ::content .grid-item-w100 {width:  100%;}

d0de5d86   isisadmin   public room
38
39
40
41
          ::content .grid-item-h200 {height: 200px;}

          ::content .grid-item-h400 {height: 400px;}

          ::content .grid-item-h600 {height: 600px;}

          ::content .grid-item-h800 {height: 800px;}

8c7f320c   isisadmin   public room
42
43
          ::content .grid-item-c4 {background-color: #2C29FF;}

          /* ---- grid-item ---- */

d0de5d86   isisadmin   public room
44
  

8c7f320c   isisadmin   public room
45
          ::content .room-body    {color:#FFFFFF;}

d0de5d86   isisadmin   public room
46
          ::content .room-subject

925d7edd   isisadmin   animated-grid-con...
47
          {

d0de5d86   isisadmin   public room
48
49
50
              position: absolute;

              width: 100%;

              height: 30px;

8c7f320c   isisadmin   public room
51
              bottom: 30px;

d0de5d86   isisadmin   public room
52
              background-color: rgba(0,0,0,0.6);

d0de5d86   isisadmin   public room
53
              color: #FFFFFF;

925d7edd   isisadmin   animated-grid-con...
54
          }

8c7f320c   isisadmin   public room
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
          ::content .room-subject span

          {

              top: 5px;

              left: 5px;

              position: relative;

              text-overflow: ellipsis;

              overflow: hidden;

              white-space:nowrap;

              text-overflow:ellipsis;

              display:inline-block;

          }

          ::content .room-body span

          {

              top: 5px;

              left: 5px;

              position: relative;

              text-overflow: ellipsis;

              overflow: hidden;

              text-overflow:ellipsis;

              display:inline-block;

          }

          ::content .room-timestamp

          {

              position: absolute;

              right:3px;

              bottom: 3px;

              font-size: 8px;

              color: #CCCCCC;

          }

925d7edd   isisadmin   animated-grid-con...
84
85
86
87
      </style>

  

      <template>

  

d0de5d86   isisadmin   public room
88
89
          <div id="grid-container" class="grid">

              <!--<template is="dom-repeat" items="{{data}}">

925d7edd   isisadmin   animated-grid-con...
90
                  <div class$="{{item.b}} {{item.w}} {{item.h}} {{item.c}}">{{index}}</div>

d0de5d86   isisadmin   public room
91
92
              </template>-->

              <content></content>

925d7edd   isisadmin   animated-grid-con...
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
          </div>

  

          <div class="grid-sizer"></div>

  

      </template>

  

  </dom-module>

  

  <script>

  

      Polymer({

  

          is: 'animated-grid-controllet',

  

          behaviors: [

              Polymer.NeonSharedElementAnimatableBehavior

          ],

  

          properties: {

              animationConfig: {

                  type: Object,

                  value: function() {

                      return {

                          'exit': [{

                              name: 'ripple-animation',

                              id: 'ripple',

                              fromPage: this

                          }, {

                              name: 'hero-animation',

                              id: 'hero',

                              fromPage: this

                          }]

                      }

                  }

              }

          },

  

          ready : function()

          {

d0de5d86   isisadmin   public room
132
              /*var randW = 0;

925d7edd   isisadmin   animated-grid-con...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
              var randH = 0;

              var randC = 0;

              this.data = [];

  

              for(var i=0; i<100; i++)

              {

                  randW = Math.floor(Math.random() * 2);

                  randH = Math.floor(Math.random() * 2);//randW;//0;//1;

                  randC = Math.floor(Math.random() * 5);

                  //html += '<div class="grid-item grid-item-w'+((randW*20)+20)+' grid-item-h'+((randH*200)+200)+' grid-item-c'+randC+'">Topic - '+i+'</div>';

  

                  this.push('data',    {b: 'grid-item',

                                        w: 'grid-item-w'+((randW*20)+20),

                                        h: 'grid-item-h'+((randH*200)+200),

                                        c: 'grid-item-c'+randC});

  

d0de5d86   isisadmin   public room
149
              }*/

925d7edd   isisadmin   animated-grid-con...
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
          },

  

          attached : function()

          {

              $('.grid').masonry({

                  itemSelector: '.grid-item',

                  columnWidth: 200

              });

          },

  

          listeners: {

              click: '_onClick'

          },

  

          _onClick: function(event) {

  

              var target = event.target;

  

8c7f320c   isisadmin   public room
168
169
              while(target.classList[0] != "grid-item")

                  target = target.parentElement;

be426b06   isisadmin   private room
170
  

925d7edd   isisadmin   animated-grid-con...
171
172
173
174
175
176
177
178
179
180
181
182
              // configure the page animation

              this.sharedElements = {

                  'hero': target,

                  'ripple': target

              };

              this.animationConfig['exit'][0].gesture = {

                  x: event.x || event.pageX,

                  y: event.y || event.pageY

              };

  

              this.fire('tile-click', {

                  tile: target,

8c7f320c   isisadmin   public room
183
                  data: {color: target.style.backgroundColor, id:target.id}

925d7edd   isisadmin   animated-grid-con...
184
185
186
187
188
189
190
              });

  

          }

  

      });

  

  </script>