Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="surface" style="height: 190px; width: 340px;"></div>

              
            
!

CSS

              
                body {
  background-color: #000;
}

#surface {
  margin: 0 auto;
}
              
            
!

JS

              
                var geom = kendo.geometry;
var Point = geom.Point;
var draw = kendo.drawing;
var Group = draw.Group;

var Clock = kendo.Class.extend({
  init: function(container, options) {
    this.options = $.extend({}, this.options, options);
    this._center = Point.create(this.options.center);
    this._render(container);
  },

  options: {
    center: [0, 0],
    size: 100,
    offset: 0
  },

  _render: function(container) {
    var center = this._center;

    var root = new Group();
    root.append(
      this._renderMeasure(80, 20, "#e90b3a", 270, 120, "move", this._renderRightArrow(new kendo.geometry.Point(center.x, center.y - 80))),
      this._renderMeasure(59, 20, "#a0ff03", 270, 60, "exercise", this._renderChevron(new kendo.geometry.Point(center.x, center.y - 59))),
      this._renderMeasure(38, 20, "#1ad5de", 270, 0, "stand", this._renderUpArrow(new kendo.geometry.Point(center.x, center.y - 38)))
    );

    container.append(root);
  },

  _renderRightArrow: function(point) {
    var icon = new kendo.drawing.Group();
    var stroke = { stroke: { color: "#000", lineCap: "round", width: 1.8 } };

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x - 5, point.y)
                .lineTo(point.x + 5, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y - 5)
                .lineTo(point.x + 5, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y + 5)
                .lineTo(point.x + 5, point.y));

    return icon;
  },

  _renderChevron: function(point) {
    var icon = new kendo.drawing.Group();
    var stroke = { stroke: { color: "#000", lineCap: "round", width: 1.8 } };

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x - 6, point.y)
                .lineTo(point.x + 4, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y - 5)
                .lineTo(point.x + 4, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y + 5)
                .lineTo(point.x + 4, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x + 4, point.y - 5)
                .lineTo(point.x + 8, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x + 4, point.y + 5)
                .lineTo(point.x + 8, point.y));

    return icon;
  },

  _renderUpArrow: function(point) {
    var icon = new kendo.drawing.Group();
    var stroke = { stroke: { color: "#000", lineCap: "round", width: 1.8 } };

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y - 5)
                .lineTo(point.x, point.y + 5));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x, point.y - 5)
                .lineTo(point.x + 5, point.y));

    icon.append(new kendo.drawing.Path(stroke)
                .moveTo(point.x - 5, point.y)
                .lineTo(point.x, point.y - 5));

    return icon;
  },

  _renderMeasure: function(radius, width, measureColor, startValue, endValue, activityName, icon) {
    var center = this._center;
    var measure = new Group();

    var circleGeometry = new kendo.geometry.Circle(center, radius);

    var gradient = new kendo.drawing.LinearGradient({
      stops: [{
        offset: 0,
        color: "#f00"
      }, {
        offset: 0.5,
        color: "#0f0",
        opacity: 0.9
      }, {
        offset: 0.5,
        color: "#00f",
        opacity: 0.9
      }, {
        offset: 1,
        color: "#fff",
      }]
    });

    measure.append(new kendo.drawing.Circle(circleGeometry, {
      stroke: {
        color: measureColor,
        opacity: 0.3,
        width: width
      }
    }));

    var arcGeometry = new kendo.geometry.Arc(this._center, {
      startAngle: startValue,
      endAngle: endValue,
      radiusX: radius,
      radiusY: radius
    });

    var arc = new kendo.drawing.Arc(arcGeometry, {
      stroke: {
        color: measureColor,
        lineCap: "round",
        width: width
      }
    });

    measure.append(arc);

    var text = new kendo.drawing.Text(
      activityName.toUpperCase(),
      new kendo.geometry.Point(center.x - 12.5, center.y - radius - 4.5),
      {
        fill: {
          color: measureColor
        }
      }
    );

    var bbox = text.bbox();
    text.position().translate(-bbox.width(), 0);

    //            var animation = kendo.drawing.Animation.create(text, {
    //              duration: 100
    //            });

    measure.append(text);

    measure.append(icon);

    return measure;
  },
});

function initSurface(type) {
  return draw.Surface.create($("#surface"), { type: type });
}

function initClocks(container) {
  var local = new Clock(container, {
    center: [170, 95],
    size: 300
  });

  return [local];
}

$(document).ready(function() {
  var surface = initSurface();

  var root = new Group();
  var clocks = initClocks(root);

  surface.draw(root);
});

              
            
!
999px

Console