Skip to content

Repository files navigation

WJMagicCurveView

By setting several parameters simply, You'll get a fancy Magic Curve immediately.

中文介绍,来自Android-CJJ同学

Let's see what it is

OrderDemo
1
2
3
4
5

How it works

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!

How to create your own curve

We provide eight base parameters for normal users and more for developers from code level. Here are explaintion for these parameters:

  1. radiusAXradiusAY: A point is the outer rotating point, these two are the radius of A;
  2. radiusBXradiusBY: B point is the inner rotating point;
  3. speedOuterPointspeedInnerPoint: the rotating speed for A & B;
  4. loopTotalCount: the loop count for these two rotating points;
  5. durationSeconds: the durationg speed for rotating.

Playable apk

Download it from here and make a try!

How to use it

WJMagicCurveViewwjMagicCurveView = (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 valuewjMagicCurveView.setRadius(radiusAX, radiusAY, radiusBX, radiusBY)
.setDurationSec(durationSeconds)
.setLoopTotalCount(loopTotalCount)
.setSpeed(speedOuterPoint, speedInnerPoint)
.startDraw();
// stop DrawwjMagicCurveView.stopDraw();
// destory and recycle bitmapwjMagicCurveView.destory();
// Customize your own curve hereIcreateaenumcalledWJMagicCurveViewParameters, YoucancreateyourownWJMagicCurveViewParameterswitheightparameters,
foremptyfields, use -1asdefaultvalue.

Related resource

有趣的曲线在Android上的实现

Processing: 简单法则的魅力

###Reach me - wingjay

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!

About

Fancy magic curve.

Resources

Stars

321 stars

Watchers

13 watching

Forks

Releases

Packages

Contributors

Languages