$scope. Toradians = function (degrees)
{
Return degrees * (math.pi/180);
}
$scope. todegrees = function (radians)
{
return radians * 180/MATH.PI;
}
$scope. initcircle = function () {
alert (document.body.clientHeight);
var w = document.body.clientWidth;
var h = document.body.clientheight-50;
var Centeroriginx = w/2 + 5;
var centeroriginy = H/3 + 20;
var paper = Raphael (' Diagram ', W, h);
$scope. paper = paper;
Paper.text (60, 10, ' skill information '). attr (' font-size ', 15);
var paper = Raphael (10, 50, 320, 200);
Draw a circle with a radius of 10 at coordinates (x = 40, y = +)
var radius = 50;
if (document.body.clientHeight <= 480) {
radius = 35;
}
var circle = paper.circle (Centeroriginx, centeroriginy, radius);
Fills the drawn circle with red (#f00)
Circle.attr ("Fill", "#2f51ac");
The color of the set Brush (stroke) is white
Circle.attr ("Stroke", "#fff"). attr (' Stroke-width ', 0);
Animate2 ();
var tag0 = ';
if ($scope. tags.length > 0 && $scope. tags[0])
tag0 = $scope. Tags[0];
var textcenter = Paper.text (Centeroriginx, Centeroriginy, tag0). attr ({
Font: "15px sans-serif"
});
Circle_outer = Paper.circle (Centeroriginx, Centeroriginy, RADIUS + 10);
Circle_outer.attr ("Stroke", "#3e58af");
var stcenter = Paper.set ();
Stcenter.push (
Circle
Circle_outer,
Textcenter
);
Animatecenter (Stcenter);
St.attr ({fill: "Red"});
Angle = self.options.dots? (Index * 360/$slides. Length): parseint ($ (slide). attr ("Data-degrees"), 10)
, Position =
// {
Top:-math.cos (Toradians (angle)) * Self.options.radius + CONTAINERSIZE.HEIGHT/2-DOTSIZE.HEIGHT/2
, Left:Math.sin (Toradians (angle)) * Self.options.radius + CONTAINERSIZE.WIDTH/2-DOTSIZE.WIDTH/2
// }
var i = 1;
var length = 7;
while (I < $scope. tags.length + 1) {
var color = ' #67bacb ';
switch (i) {
Case 1:
color = ' #e3423f ';
Break
Case 2:
color = ' #f88500 ';
Break
Case 3:
color = ' #d9c93a ';
Break
Case 4:
color = ' #009da1 ';
Break
Case 5:
color = ' #55c042 ';
Break
Case 6:
color = ' #283388 ';
Break
}
var r = radius;
var angle = i * 360/$scope. tags.length;
var top =-math.cos ($scope. Toradians (angle)) * + CENTERORIGINY-10/2;
var left = Math.sin ($scope. Toradians (angle)) * + CENTERORIGINX-10/2;
var C = paper.circle (left, top, radius-10);
C.click (function () {
S.animate ({transform:t, stroke:c}, +, "bounce");
This.animate ({cx:this.attr (' cx ')}, This.attr (' cx ') +, "elastic");
THIS.CX = 400;
}). Touchstart (function () {
This.animate ({"fill-opacity":. 75}, 500);
}). Touchend (function () {
This.animate ({"Fill-opacity":. 4}, 500);
});
Fills the drawn circle with red (#f00)
C.attr ("Fill", color). attr (' Stroke-width ', 0);
var _anim = raphael.animation ({50:{"fill-opacity":. 1}, 1000:{"Fill-opacity":. 8}}, 2000);
C.animate (_anim.repeat ("Infinity"));
var _txt = Paper.text (left, top, $scope. tags[i-1]). attr ({
Font: "13px sans-serif", fill: ' #ffffff '
});
var _set = Paper.set ();
_set.push (
C
_txt
);
Animatecenter (_set);
++i;
}
var _y = h-100;
var rect = paper.rect (0, _y, W, 90);
_y + = 40;
Rect.attr (' Fill ', ' #2f51ab '). attr ("Stroke", "#3e58af");
var _txt = Paper.text (_y, ' personal description: ' + $scope. desc). attr ({
Font: "15px sans-serif", fill: ' #ffffff '
});
function Animatecenter (o) {
var ms = 4000;
var _r = 50;
if (document.body.clientHeight <= 480) {
_r = 35;
}
var anim = raphael.animation ({
50: {
R: _r,
Stroke: ' #f00 ',
"Fill-opacity":. 95
},
100: {
R:40,
Stroke: ' #fff ',
"Fill-opacity":. 4
},350: {
R: _r,
Stroke: ' #f00 ',
"Fill-opacity": 1
}
}, MS);
O.animate (Anim.repeat ("Infinity")); Infinity for an unlimited number of times
}
function Animate2 () {
var ms = 1000;
var easing = ' elastic ';
Stcenter.animate ({
Cx:centeroriginx + math.random () * 120,//center X coordinate
Cy:centeroriginy + math.random () * 100,//center Y coordinate
}, MS, easing, function () {
SetTimeout (Animate2, 1000);
});
}
function animate () {
var ms = 1000;
var easing = [' elastic ', ' ', ' bounce ', ' ease-in-out '][math.round (Math.random () * 3)];
Circle.animate ({
Cx:50 + math.random () * 120,//center X coordinate
Cy:50 + math.random () * 100,//center Y coordinate
}, MS, easing, function () {
SetTimeout (animate, 1000);
});
}
}
Raphael Draw Circle Wrapping method