By setting several parameters simply, You'll get a fancy Magic Curve immediately.
Order | Demo |
---|---|
1 | |
2 | |
3 | |
4 | |
5 |
By setting eight parameters
(Of course you don't have to set every because they all have default value), WJMagicCurveView
will draw a beautiful curve based on a math function.
First, we'll create two points and make them rotate
in specified speed
and specified radius
revolving a same center;
Second, whenever they reach a point during rotating, we'll draw a line connecting these two points
;
Thirds, continue rotate and draw lines, Bingo! You're creating a new beautiful curve!
We provide eight base parameters for normal users and more for developers from code level. Here are explaintion for these parameters:
radiusAX
、radiusAY
: A point is the outer rotating point, these two are the radius of A;radiusBX
、radiusBY
: B point is the inner rotating point;speedOuterPoint
、speedInnerPoint
: the rotating speed for A & B;loopTotalCount
: the loop count for these two rotating points;durationSeconds
: the durationg speed for rotating.
Download it from here and make a try!
WJMagicCurveView wjMagicCurveView = (WJMagicCurveView) findViewById(R.id.wj_magic_curve_view);
// set parameters. of course it's not necessary to set all these parameters because they all have default value
wjMagicCurveView.setRadius(radiusAX, radiusAY, radiusBX, radiusBY)
.setDurationSec(durationSeconds)
.setLoopTotalCount(loopTotalCount)
.setSpeed(speedOuterPoint, speedInnerPoint)
.startDraw();
// stop Draw
wjMagicCurveView.stopDraw();
// destory and recycle bitmap
wjMagicCurveView.destory();
// Customize your own curve here
I create a enum called WJMagicCurveViewParameters,
You can create your own WJMagicCurveViewParameters with eight parameters,
for empty fields, use -1 as default value.
You can get information about me and reach me in my github page: https://github.com/wingjay
Blog: http://wingjay.com
Weibo: http://weibo.com/u/1625892654
Feel free to give me advices by mailto:yinjiesh@126.com
Thanks!