Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: sky/framework/sky-drawer.sky

Issue 954023002: Implement quantum ink splashes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: nits Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/framework/material-element.sky ('k') | sky/framework/sky-ink-splash.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Copyright 2015 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="shadow.sky" as="shadow" /> 6 <import src="shadow.sky" as="shadow" />
7 <import src="sky-element.sky" /> 7 <import src="sky-element.sky" />
8 <import src="sky-scrollable.sky" /> 8 <import src="sky-scrollable.sky" />
9 9
10 <sky-element attributes="level:number"> 10 <sky-element attributes="level:number">
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (!_animation.isAnimating) 137 if (!_animation.isAnimating)
138 _settle(); 138 _settle();
139 } 139 }
140 140
141 void _handlePointerCancel(_) { 141 void _handlePointerCancel(_) {
142 if (!_animation.isAnimating) 142 if (!_animation.isAnimating)
143 _settle(); 143 _settle();
144 } 144 }
145 145
146 void _handleFlingStart(event) { 146 void _handleFlingStart(event) {
147 double direction = event.velocityX.sign(); 147 double direction = event.velocityX.sign;
148 double velocityX = event.velocityX.abs() / 1000; 148 double velocityX = event.velocityX.abs() / 1000;
149 if (velocityX < _kMinFlingVelocity) 149 if (velocityX < _kMinFlingVelocity)
150 return; 150 return;
151 double targetPosition = direction < 0.0 ? -kWidth : 0.0; 151 double targetPosition = direction < 0.0 ? -kWidth : 0.0;
152 double currentPosition = _position; 152 double currentPosition = _position;
153 double distance = (targetPosition - currentPosition).abs(); 153 double distance = (targetPosition - currentPosition).abs();
154 double duration = distance / velocityX; 154 double duration = distance / velocityX;
155 _animation.start( 155 _animation.start(
156 begin: currentPosition, 156 begin: currentPosition,
157 end: targetPosition, 157 end: targetPosition,
158 duration: duration, 158 duration: duration,
159 curve: linear); 159 curve: linear);
160 } 160 }
161 } 161 }
162 162
163 _init(script) => register(script, SkyDrawer); 163 _init(script) => register(script, SkyDrawer);
164 </script> 164 </script>
165 </sky-element> 165 </sky-element>
OLDNEW
« no previous file with comments | « sky/framework/material-element.sky ('k') | sky/framework/sky-ink-splash.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698