From e6ffd49f9b17a64eec04ed8919b44c7c8b74a23b Mon Sep 17 00:00:00 2001 From: James Arroyo Date: Mon, 6 Nov 2017 12:47:35 -0700 Subject: [PATCH 1/9] added an animation that fades the banner's body text in and out. Using web animations api --- ab-animated-banner.html | 71 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/ab-animated-banner.html b/ab-animated-banner.html index c7d6f6e..9b00531 100644 --- a/ab-animated-banner.html +++ b/ab-animated-banner.html @@ -33,7 +33,33 @@ text-align: center; } + .banner .animation{ + height: 100%; + display: flex; + flex-wrap: wrap; + justify-content:flex-start; + + } + + .animation span{ + height: 40px; + margin: 13px 15px 0 0; + } + + .animation .img{ + height: 40px; + margin: 13px 15px 0 0; + width: 40px; + margin-left: 10px; + } + .animation .text{ + width: 200px; + padding-top: 11px; + font-size: 14px; + font-weight: 800; + color: #525252; + } @@ -42,6 +68,10 @@

[[title]]

+
+ + [[bodyText]] +
@@ -53,19 +83,58 @@

[[title]]

* @polymer */ class AbAnimatedBanner extends Polymer.Element { - static get is() { return 'ab-animated-banner'; } + + static get is() { + return 'ab-animated-banner'; + } + static get properties() { return { title: { type: String, value: 'Title' }, + bodyText: { + type: String, + value: 'Body TExt' + }, dataSet: { type: Array, value: ['Jimmy Arroyo', 'John Doe', 'Bob Smith'] } }; } + + /** + * Cycles through an array of strings displaying them one by one + * with an animation + * + * @param {Array} values An array of strings + */ + _cycleAnimation(values) { + this.$.bannerAnimation.animate([ + {transform: 'translateY(0)', opacity: 1, easing: 'ease-in'}, + {transform: 'translateY(0)', opacity: 1}, + {transform: 'translateY(0)', opacity: 1}, // Hack: added duplicate keyframe since web animations api doesnt allow a delay or duration on a specific keyframe in the sequence + {transform: 'translateY(0)', opacity: 0, easing: 'ease-out'} + ], { + duration: 4000, + iterations: Infinity, + direction: 'alternate', + fill: 'forwards' + }); + + } + + ready() { + super.ready(); + + // Start cycle animation + this._cycleAnimation(['1', '2', '3', '4', '5']); + } + + + } window.customElements.define(AbAnimatedBanner.is, AbAnimatedBanner); From 28723bd1c94700869570c6c46b930c4eaeaed553 Mon Sep 17 00:00:00 2001 From: James Arroyo Date: Tue, 7 Nov 2017 11:34:45 -0700 Subject: [PATCH 2/9] add DS_Store to the git ignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8d4ae25..b13058c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ bower_components +.DS_Store From 135bc6f0fa349be712270ae6882f3cccf95eabb8 Mon Sep 17 00:00:00 2001 From: James Arroyo Date: Tue, 7 Nov 2017 11:37:35 -0700 Subject: [PATCH 3/9] added functionality to loop through provided strings and display them inside the banner with the animation --- ab-animated-banner.html | 59 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/ab-animated-banner.html b/ab-animated-banner.html index 9b00531..4d03232 100644 --- a/ab-animated-banner.html +++ b/ab-animated-banner.html @@ -21,56 +21,48 @@ } - .banner .innerLeft{ + .banner .titleBox{ height: 100%; width: 20%; float: left; background: rgba(253,202,0,1); } - .innerLeft h4{ + .titleBox h4{ font-size: 20px; text-align: center; } - .banner .animation{ + .banner .body{ height: 100%; display: flex; flex-wrap: wrap; justify-content:flex-start; - } - .animation span{ + .body span{ height: 40px; margin: 13px 15px 0 0; } - .animation .img{ - height: 40px; - margin: 13px 15px 0 0; - width: 40px; - margin-left: 10px; - } - - .animation .text{ + .body .text{ width: 200px; padding-top: 11px; font-size: 14px; font-weight: 800; color: #525252; + margin-left: 10px; }