├── README.md ├── android-selfAnim.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── uuch │ │ └── com │ │ └── android_selfanim │ │ └── ExampleInstrumentationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── uuch │ │ │ └── com │ │ │ └── android_selfanim │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable │ │ ├── aaa.jpg │ │ └── paint.png │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── uuch │ └── com │ └── android_selfanim │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images └── mygif.gif ├── librarys ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── uuch │ │ └── com │ │ └── selfanim │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── uuch │ │ │ └── com │ │ │ └── selfanim │ │ │ ├── CommenUtils.java │ │ │ ├── DrawUtils.java │ │ │ ├── SelfDrawView.java │ │ │ └── SobelUtils.java │ └── res │ │ ├── drawable │ │ └── paint.png │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── uuch │ └── com │ └── selfanim │ └── ExampleUnitTest.java ├── local.properties └── settings.gradle /README.md: -------------------------------------------------------------------------------- 1 | # android-selfAnim 2 | 3 | 实现android素描动画效果,不是我写滴,是参考:Android自动手绘,圆你儿时画家梦!,做了一些优化和改动 4 | 5 | ![image](https://github.com/yipianfengye/android-selfAnim/blob/master/images/mygif.gif) 6 | -------------------------------------------------------------------------------- /android-selfAnim.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "24.0.0" 6 | defaultConfig { 7 | applicationId "uuch.com.android_selfanim" 8 | minSdkVersion 21 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | android { 16 | lintOptions { 17 | abortOnError false 18 | } 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | compile 'com.android.support:appcompat-v7:23.4.0' 32 | compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1' 33 | testCompile 'junit:junit:4.12' 34 | androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 35 | androidTestCompile 'com.android.support.test:runner:0.5' 36 | androidTestCompile 'com.android.support:support-annotations:23.4.0' 37 | // compile project(':librarys') 38 | compile 'cn.yipianfengye.selfanim:self-anim:1.0.0' 39 | } 40 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/aaron/document/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/uuch/com/android_selfanim/ExampleInstrumentationTest.java: -------------------------------------------------------------------------------- 1 | package uuch.com.android_selfanim; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.filters.MediumTest; 6 | import android.support.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | 12 | import static org.junit.Assert.*; 13 | 14 | /** 15 | * Instrumentation test, which will execute on an Android device. 16 | * 17 | * @see Testing documentation 18 | */ 19 | @MediumTest 20 | @RunWith(AndroidJUnit4.class) 21 | public class ExampleInstrumentationTest { 22 | @Test 23 | public void useAppContext() throws Exception { 24 | // Context of the app under test. 25 | Context appContext = InstrumentationRegistry.getTargetContext(); 26 | 27 | assertEquals("uuch.com.android_selfanim", appContext.getPackageName()); 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/uuch/com/android_selfanim/MainActivity.java: -------------------------------------------------------------------------------- 1 | package uuch.com.android_selfanim; 2 | 3 | import android.graphics.Bitmap; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.ImageView; 9 | 10 | import uuch.com.selfanim.DrawUtils; 11 | import uuch.com.selfanim.SelfDrawView; 12 | 13 | /** 14 | * 绘制操作工具类 15 | */ 16 | public class MainActivity extends AppCompatActivity { 17 | 18 | private ImageView imageSource = null; 19 | private SelfDrawView imageDirsction = null; 20 | private Button button1 = null; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_main); 26 | 27 | initView(); 28 | 29 | initListener(); 30 | } 31 | 32 | /** 33 | * 初始化组件 34 | */ 35 | private void initView() { 36 | imageSource = (ImageView) findViewById(R.id.image_source); 37 | imageDirsction = (SelfDrawView) findViewById(R.id.image_direction); 38 | button1 = (Button) findViewById(R.id.button1); 39 | } 40 | 41 | /** 42 | * 初始化事件监听 43 | */ 44 | private void initListener() { 45 | button1.setOnClickListener(new View.OnClickListener() { 46 | @Override 47 | public void onClick(View v) { 48 | 49 | imageSource.buildDrawingCache(); 50 | Bitmap bitmapSource = imageSource.getDrawingCache(); 51 | /** 52 | * 开始执行绘制素描的操作 53 | */ 54 | DrawUtils.startSelfDraw(imageDirsction, bitmapSource); 55 | } 56 | }); 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/aaa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yipianfengye/android-selfAnim/4307a7575272f04b8b1f4f981280b904b5d44451/app/src/main/res/drawable/aaa.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/paint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yipianfengye/android-selfAnim/4307a7575272f04b8b1f4f981280b904b5d44451/app/src/main/res/drawable/paint.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 16 | 24 | 25 | 33 | 34 |