| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 Add the class `transiting` to a paper-progress to animate the progress bar when | 52 Add the class `transiting` to a paper-progress to animate the progress bar when |
| 53 the value changed. You can also customize the transition: | 53 the value changed. You can also customize the transition: |
| 54 | 54 |
| 55 paper-progress { | 55 paper-progress { |
| 56 --paper-progress-transition-duration: 0.08s; | 56 --paper-progress-transition-duration: 0.08s; |
| 57 --paper-progress-transition-timing-function: ease; | 57 --paper-progress-transition-timing-function: ease; |
| 58 --paper-progress-transition-transition-delay: 0s; | 58 --paper-progress-transition-transition-delay: 0s; |
| 59 } | 59 } |
| 60 | 60 |
| 61 The following mixins are available for styling: |
| 62 |
| 63 |
| 64 |
| 65 Custom property | Description | Default |
| 66 ----------------|-------------|---------- |
| 67 `--paper-progress-container` | Mixin applied to container | `{}` |
| 68 |
| 69 |
| 70 |
| 71 |
| 61 @group Paper Elements | 72 @group Paper Elements |
| 62 @element paper-progress | 73 @element paper-progress |
| 63 @hero hero.svg | 74 @hero hero.svg |
| 64 @demo demo/index.html | 75 @demo demo/index.html |
| 65 --> | 76 --> |
| 66 | 77 |
| 67 <dom-module id="paper-progress"> | 78 <dom-module id="paper-progress"> |
| 68 <style> | 79 <style> |
| 69 :host { | 80 :host { |
| 70 display: inline-block; | 81 display: inline-block; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 transition-timing-function: var(--paper-progress-transition-timing-functio
n, ease); | 97 transition-timing-function: var(--paper-progress-transition-timing-functio
n, ease); |
| 87 | 98 |
| 88 /* Delay */ | 99 /* Delay */ |
| 89 -webkit-transition-delay: var(--paper-progress-transition-delay, 0s); | 100 -webkit-transition-delay: var(--paper-progress-transition-delay, 0s); |
| 90 transition-delay: var(--paper-progress-transition-delay, 0s); | 101 transition-delay: var(--paper-progress-transition-delay, 0s); |
| 91 } | 102 } |
| 92 | 103 |
| 93 #progressContainer { | 104 #progressContainer { |
| 94 position: relative; | 105 position: relative; |
| 95 height: 100%; | 106 height: 100%; |
| 107 overflow: hidden; |
| 108 @apply(--paper-progress-container); |
| 109 } |
| 110 |
| 111 #progressContainer, #indeterminateSplitter { |
| 96 background-color: var(--paper-progress-container-color, --google-grey-300)
; | 112 background-color: var(--paper-progress-container-color, --google-grey-300)
; |
| 97 overflow: hidden; | |
| 98 } | 113 } |
| 99 | 114 |
| 100 #activeProgress, | 115 #activeProgress, |
| 101 #secondaryProgress { | 116 #secondaryProgress { |
| 102 -webkit-transform-origin: left center; | 117 -webkit-transform-origin: left center; |
| 103 transform-origin: left center; | 118 transform-origin: left center; |
| 104 -webkit-transform: scaleX(0); | 119 -webkit-transform: scaleX(0); |
| 105 transform: scaleX(0); | 120 transform: scaleX(0); |
| 106 } | 121 } |
| 107 | 122 |
| 108 #activeProgress { | 123 #activeProgress { |
| 109 background-color: var(--paper-progress-active-color, --google-green-500); | 124 background-color: var(--paper-progress-active-color, --google-green-500); |
| 110 } | 125 } |
| 111 | 126 |
| 112 #secondaryProgress { | 127 #secondaryProgress { |
| 113 background-color: var(--paper-progress-secondary-color, --google-green-100
); | 128 background-color: var(--paper-progress-secondary-color, --google-green-100
); |
| 114 } | 129 } |
| 130 |
| 131 #indeterminateSplitter { |
| 132 display: none; |
| 133 } |
| 115 | 134 |
| 116 #activeProgress.indeterminate { | 135 #activeProgress.indeterminate { |
| 136 -webkit-transform-origin: right center; |
| 137 transform-origin: right center; |
| 138 -webkit-animation: indeterminate-bar 2s linear infinite; |
| 139 animation: indeterminate-bar 2s linear infinite; |
| 140 } |
| 141 |
| 142 #indeterminateSplitter.indeterminate { |
| 143 display: block; |
| 117 -webkit-transform-origin: center center; | 144 -webkit-transform-origin: center center; |
| 118 transform-origin: center center; | 145 transform-origin: center center; |
| 119 -webkit-animation: indeterminate-bar 1s linear infinite; | 146 -webkit-animation: indeterminate-splitter 2s linear infinite; |
| 120 animation: indeterminate-bar 1s linear infinite; | 147 animation: indeterminate-splitter 2s linear infinite; |
| 121 } | 148 } |
| 122 | 149 |
| 123 @-webkit-keyframes indeterminate-bar { | 150 @-webkit-keyframes indeterminate-bar { |
| 124 0% { | 151 0% { |
| 125 -webkit-transform: translate(-50%) scaleX(0); | 152 -webkit-transform: scaleX(1) translateX(-100%); |
| 126 } | 153 } |
| 127 50% { | 154 50% { |
| 128 -webkit-transform: translate(0%) scaleX(0.3); | 155 -webkit-transform: scaleX(1) translateX(0%); |
| 156 } |
| 157 75% { |
| 158 -webkit-transform: scaleX(1) translateX(0%); |
| 159 -webkit-animation-timing-function: cubic-bezier(.28,.62,.37,.91); |
| 129 } | 160 } |
| 130 100% { | 161 100% { |
| 131 -webkit-transform: translate(50%) scaleX(0); | 162 -webkit-transform: scaleX(0) translateX(0%); |
| 163 } |
| 164 } |
| 165 |
| 166 @-webkit-keyframes indeterminate-splitter { |
| 167 0% { |
| 168 -webkit-transform: scaleX(.75) translateX(-125%); |
| 169 } |
| 170 30% { |
| 171 -webkit-transform: scaleX(.75) translateX(-125%); |
| 172 -webkit-animation-timing-function: cubic-bezier(.42,0,.6,.8); |
| 173 } |
| 174 90% { |
| 175 -webkit-transform: scaleX(.75) translateX(125%); |
| 176 } |
| 177 100% { |
| 178 -webkit-transform: scaleX(.75) translateX(125%); |
| 132 } | 179 } |
| 133 } | 180 } |
| 134 | 181 |
| 135 @keyframes indeterminate-bar { | 182 @keyframes indeterminate-bar { |
| 136 0% { | 183 0% { |
| 137 transform: translate(-50%) scaleX(0); | 184 transform: scaleX(1) translateX(-100%); |
| 138 } | 185 } |
| 139 50% { | 186 50% { |
| 140 transform: translate(0%) scaleX(0.3); | 187 transform: scaleX(1) translateX(0%); |
| 188 } |
| 189 75% { |
| 190 transform: scaleX(1) translateX(0%); |
| 191 animation-timing-function: cubic-bezier(.28,.62,.37,.91); |
| 141 } | 192 } |
| 142 100% { | 193 100% { |
| 143 transform: translate(50%) scaleX(0); | 194 transform: scaleX(0) translateX(0%); |
| 195 } |
| 196 } |
| 197 |
| 198 @keyframes indeterminate-splitter { |
| 199 0% { |
| 200 transform: scaleX(.75) translateX(-125%); |
| 201 } |
| 202 30% { |
| 203 transform: scaleX(.75) translateX(-125%); |
| 204 animation-timing-function: cubic-bezier(.42,0,.6,.8); |
| 205 } |
| 206 90% { |
| 207 transform: scaleX(.75) translateX(125%); |
| 208 } |
| 209 100% { |
| 210 transform: scaleX(.75) translateX(125%); |
| 144 } | 211 } |
| 145 } | 212 } |
| 146 </style> | 213 </style> |
| 147 <template> | 214 <template> |
| 148 <div id="progressContainer" role="progressbar" aria-valuenow$="{{value}}" ar
ia-valuemin$="{{min}}" aria-valuemax$="{{max}}"> | 215 <div id="progressContainer" role="progressbar" aria-valuenow$="{{value}}" ar
ia-valuemin$="{{min}}" aria-valuemax$="{{max}}"> |
| 149 <div id="secondaryProgress" class="fit"></div> | 216 <div id="secondaryProgress" class="fit"></div> |
| 150 <div id="activeProgress" class="fit"></div> | 217 <div id="activeProgress" class="fit"></div> |
| 218 <div id="indeterminateSplitter" class="fit"></div> |
| 151 </div> | 219 </div> |
| 152 </template> | 220 </template> |
| 153 </dom-module> | 221 </dom-module> |
| 154 | 222 |
| 155 <script> | 223 <script> |
| 156 Polymer({ | 224 Polymer({ |
| 157 | 225 |
| 158 is: 'paper-progress', | 226 is: 'paper-progress', |
| 159 | 227 |
| 160 behaviors: [ | 228 behaviors: [ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 263 |
| 196 observers: [ | 264 observers: [ |
| 197 '_ratioChanged(ratio)', | 265 '_ratioChanged(ratio)', |
| 198 '_secondaryProgressChanged(secondaryProgress, min, max)' | 266 '_secondaryProgressChanged(secondaryProgress, min, max)' |
| 199 ], | 267 ], |
| 200 | 268 |
| 201 _toggleIndeterminate: function() { | 269 _toggleIndeterminate: function() { |
| 202 // If we use attribute/class binding, the animation sometimes doesn't tran
slate properly | 270 // If we use attribute/class binding, the animation sometimes doesn't tran
slate properly |
| 203 // on Safari 7.1. So instead, we toggle the class here in the update metho
d. | 271 // on Safari 7.1. So instead, we toggle the class here in the update metho
d. |
| 204 this.toggleClass('indeterminate', this.indeterminate, this.$.activeProgres
s); | 272 this.toggleClass('indeterminate', this.indeterminate, this.$.activeProgres
s); |
| 273 this.toggleClass('indeterminate', this.indeterminate, this.$.indeterminate
Splitter); |
| 205 }, | 274 }, |
| 206 | 275 |
| 207 _transformProgress: function(progress, ratio) { | 276 _transformProgress: function(progress, ratio) { |
| 208 var transform = 'scaleX(' + (ratio / 100) + ')'; | 277 var transform = 'scaleX(' + (ratio / 100) + ')'; |
| 209 progress.style.transform = progress.style.webkitTransform = transform; | 278 progress.style.transform = progress.style.webkitTransform = transform; |
| 210 }, | 279 }, |
| 211 | 280 |
| 212 _ratioChanged: function(ratio) { | 281 _ratioChanged: function(ratio) { |
| 213 this._transformProgress(this.$.activeProgress, ratio); | 282 this._transformProgress(this.$.activeProgress, ratio); |
| 214 }, | 283 }, |
| 215 | 284 |
| 216 _secondaryRatioChanged: function(secondaryRatio) { | 285 _secondaryRatioChanged: function(secondaryRatio) { |
| 217 this._transformProgress(this.$.secondaryProgress, secondaryRatio); | 286 this._transformProgress(this.$.secondaryProgress, secondaryRatio); |
| 218 }, | 287 }, |
| 219 | 288 |
| 220 _secondaryProgressChanged: function() { | 289 _secondaryProgressChanged: function() { |
| 221 this.secondaryProgress = this._clampValue(this.secondaryProgress); | 290 this.secondaryProgress = this._clampValue(this.secondaryProgress); |
| 222 this._setSecondaryRatio(this._calcRatio(this.secondaryProgress) * 100); | 291 this._setSecondaryRatio(this._calcRatio(this.secondaryProgress) * 100); |
| 223 } | 292 } |
| 224 | 293 |
| 225 }); | 294 }); |
| 226 | 295 |
| 227 </script> | 296 </script> |
| OLD | NEW |