From bf89e0ea92bdf717a08460dda2b4c886297845fc Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 15 Jan 2016 19:03:40 +0000 Subject: [PATCH] Arc-progress --- app/js/directives.js | 43 +++++++++++++++++++++++ app/less/app.less | 56 ++++++++++++++++++++++++++++++ app/partials/desktop/full_gif.html | 23 +++++------- 3 files changed, 107 insertions(+), 15 deletions(-) diff --git a/app/js/directives.js b/app/js/directives.js index 114f7d95..98a8d431 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -3232,6 +3232,49 @@ angular.module('myApp.directives', ['myApp.filters']) }; }) + .directive('myArcProgress', function () { + var html = ''; + return { + scope: { + progress: '=myArcProgress' + }, + link: function ($scope, element, attrs) { + element + .html(html) + .addClass('progress-arc-wrap'); + + var svgEl = element[0].firstChild; + var circle = $('.progress-arc-circle', element); + var bar = $('.progress-arc-bar', element); + + var width = attrs.width || 40; + var radius = width * 0.86; + var stroke = width * 0.14; + var center = width / 2; + + $(svgEl).attr('width', width); + $(svgEl).attr('height', width); + circle.attr('cx', center); + circle.attr('cy', center); + circle.attr('r', radius); + circle.css({strokeWidth: stroke}); + + bar.attr('cx', center); + bar.attr('cy', center); + bar.attr('r', radius); + bar.css({strokeWidth: stroke}); + + var fullLen = 2 * Math.PI * radius; + $scope.$watch('progress', function (newProgress) { + var progress = newProgress / 100.0; + progress = Math.max(0.0, Math.min(progress, 1.0)); + bar.css({strokeDasharray: (progress * fullLen) + ', ' + ((1 - progress) * fullLen)}); + }); + + } + } + }) + .directive('myScrollToOn', function () { return { diff --git a/app/less/app.less b/app/less/app.less index 6f6118d3..1fa9862c 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -416,6 +416,62 @@ a { } } +.progress-arc-wrap { + display: block; + border-radius: 100%; +} +.progress-arc circle { + stroke-dashoffset: 0; + stroke: rgba(0,0,0,0.3); + stroke-width: 3px; +} +.progress-arc .progress-arc-bar { + stroke: #FFF; + transform-origin: center center; + transition: stroke-dasharray 500ms linear; + + -webkit-animation: infinite_rotation 2s linear infinite; + -moz-animation: infinite_rotation 2s linear infinite; + -ms-animation: infinite_rotation 2s linear infinite; + animation: infinite_rotation 2s linear infinite; +} + +/* Infinite rotation */ +@-webkit-keyframes infinite_rotation { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} +@-moz-keyframes infinite_rotation { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} +@-ms-keyframes infinite_rotation { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} +@keyframes infinite_rotation { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} + + + .dropdown-menu { border-radius: 2px; padding: 0; diff --git a/app/partials/desktop/full_gif.html b/app/partials/desktop/full_gif.html index cb11efa6..4c96f20e 100644 --- a/app/partials/desktop/full_gif.html +++ b/app/partials/desktop/full_gif.html @@ -2,6 +2,14 @@
+
+
+
+
GIF
+
+
+
+
-
- -
-
-
-
-
- -
-
GIF
-
-
- -
- \ No newline at end of file