From 30f3504cd6539762bf4958892ac592228060229b Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Mon, 29 Oct 2012 15:10:00 -0700 Subject: [PATCH] g-overlay: - rename 'showing' property to 'opened' - simplify event listeners - style animations based on 'opened' and 'animating' attributes - add beginnings of library of open/close animations --- src/css/g-overlay.css | 103 ++++++++++++++++++++++++++++++++++++++ src/g-overlay.html | 110 ++++++++++++++++++++++++----------------- workbench/overlay.html | 96 ++++------------------------------- 3 files changed, 177 insertions(+), 132 deletions(-) create mode 100644 src/css/g-overlay.css diff --git a/src/css/g-overlay.css b/src/css/g-overlay.css new file mode 100644 index 0000000000..f9d30cf139 --- /dev/null +++ b/src/css/g-overlay.css @@ -0,0 +1,103 @@ +/* + * Copyright 2012 The Toolkitchen Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +@host { + position: fixed; + z-index: 10; + outline: none; +} + +/* + TODO(sorvell): include a reasonable set of default overlay opening + animations. What's here right now is ad hoc. +*/ +@host.g-overlay-fade { + opacity: 0; + -webkit-transition: all 0.218s; +} + +@host.g-overlay-fade[opened] { + opacity: 1; +} + +@host.g-overlay-scale-slideup { + opacity: 0.0; + -webkit-transform: scale(1.05); + -webkit-transition: all 0.218s; +} + +@host.g-overlay-scale-slideup[opened] { + opacity: 1.0; + -webkit-transform: scale(1.0); +} + +@host.g-overlay-scale-slideup:not([opened])[animating] { + opacity: 0; + -webkit-transform: translateY(-100%); + -webkit-transition: all 1s; +} + +@-webkit-keyframes g-overlay-shakeFadeIn { + 0% { + display: block; + opacity: 0; + -webkit-transform: translateX(0); + } + 10% { + display: block; + -webkit-transform: translateX(-50px); + } + 30% { + display: block; + -webkit-transform: translateX(50px); + } + 50% { + display: block; + -webkit-transform: translateX(-25px); + } + 70% { + display: block; + -webkit-transform: translateX(25px); + } + 90% { + display: block; + -webkit-transform: translateX(-13px); + } + 100% { + display: block; + -webkit-transform: translateX(0); + opacity: 1; + } +} + +@-webkit-keyframes g-overlay-shakeFadeOut { + 0% { + opacity: 1; + -webkit-transform: translateX(0); + } + 10% { + -webkit-transform: translateX(-50px); + } + 30% { + -webkit-transform: translateX(50px); + } + 100% { + -webkit-transform: translateX(-100%); + opacity: 0; + } +} + +@host.g-overlay-shake[opened] { + -webkit-animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: g-overlay-shakeFadeIn; +} + +@host.g-overlay-shake:not([opened])[animating] { + -webkit-animation-duration: 0.3s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: g-overlay-shakeFadeOut; +} \ No newline at end of file diff --git a/src/g-overlay.html b/src/g-overlay.html index 4cb1e16210..c62cd916bb 100644 --- a/src/g-overlay.html +++ b/src/g-overlay.html @@ -5,70 +5,90 @@ * license that can be found in the LICENSE file. */ --> - + + + - +

Dialog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed fringilla sapien sed enim sollicitudin laoreet. Suspendisse suscipit, metus ac volutpat sodales, libero magna semper lacus, molestie fringilla massa orci ut arcu. Nullam sodales urna sit amet odio vehicula mattis.


Ut aliquam vulputate congue. Vestibulum pretium pretium nulla quis sollicitudin. Praesent lacinia congue erat nec mattis. Fusce commodo lacus est. Duis turpis eros, ultrices sed aliquet non, blandit egestas velit. Integer a augue nec lorem tristique hendrerit. Curabitur imperdiet risus id enim bibendum vestibulum. Integer id magna at arcu faucibus fermentum vel a augue. Sed fringilla venenatis dolor, in blandit magna molestie luctus. Vestibulum dignissim posuere ultrices. Aenean urna nisl, tincidunt vitae iaculis ut, pharetra nec eros.


@@ -118,20 +40,20 @@

Dialog

I agree with this wholeheartedly.

- +


- +

Dialog 2

I'm dizzy.

- +