jaredrummler / animatedsvgview Goto Github PK
View Code? Open in Web Editor NEWAnimated SVG Drawing for Android
License: Apache License 2.0
Animated SVG Drawing for Android
License: Apache License 2.0
Program type already present: android.support.v4.graphics.drawable.IconCompatParcelizer
The 1.0.1 version of the library has not been published on the maven repository. Please consider updating the artifacts, since we are going to use the new "mTraceMarkerLength" attribute.
See the following link, seems to be broken :
https://repo1.maven.org/maven2/com/jaredrummler/animated-svg-view/1.0.1/animated-svg-view-1.0.1.aar
I try some online png to svg tools, and get the path to the xml but it is not working. So how to use this lib use own image?
Please add support for SVG SMIL animations, like those used by the Viber app:
http://www.tbyrne.org/viber-animated-svgs
AnimatedSvgView not display center on the screen
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/rl"
android:background="@mipmap/back2" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" >
<com.jrummyapps.android.widget.AnimatedSvgView
android:id="@+id/animated_svg_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
app:paddingEnd="@dimen/activity_horizontal_margin"
app:animatedSvgFillColors="@array/os_colors"
app:animatedSvgGlyphStrings="@array/os_strings"
app:animatedSvgImageSizeX="400"
app:animatedSvgImageSizeY="400"
app:animatedSvgFillStart="1200"
app:animatedSvgFillTime="1000"
app:animatedSvgTraceTime="2000"
app:animatedSvgTraceTimePerGlyph="1000" />
</RelativeLayout>
</FrameLayout>
Thanks for your lib!
But you should really mention in readme to find svgView. and call svgView.start(); to start animation.
I was wondering, why it is not starting.
When there are more than 5 paths in the svg file, it throws indexoutofbounds exception.
Hi, How do we decide what should be the height and width in AnimatedSvgView?
e.g. animatedSvgImageSizeX and animatedSvgImageSizeY
I tried with a path , letter A
"M9.93,13.5h4.14L12,7.98zM20,2L4,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM15.95,18.5l-1.14,-3L9.17,15.5l-1.12,3L5.96,18.5l5.11,-13h1.86l5.11,13h-2.09z"
with size as 512, 512
but it displays very small.
then I tried with 50, 50
, it displays little bigger but its cropped at left top corner.
Please have a look at the attached screenshots.
can play svg path programming not by predefined file?
I've just upgraded my projects support library version, from 25.4.0 to 26.0.+ and the 1.0.4 version of AnimatedSvgView is throwing the following exception in my splashScreen
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/graphics/drawable/PathParser;
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at ir.sep.sesoot.ui.splash.ActivitySplash.onCreate(ActivitySplash.java:26)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.graphics.drawable.PathParser" on path: DexPathList[[zip file "/data/app/ir.sep.sesoot-2/base.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_dependencies_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_0_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_1_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_2_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_3_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_4_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_5_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_6_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_7_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_8_apk.apk", zip file "/data/app/ir.sep.sesoot-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ir.sep.sesoot-2/lib/x86, /data/app/ir.sep.sesoot-2/base.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_dependencies_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_0_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_1_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_2_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_3_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_4_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_5_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_6_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_7_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_8_apk.apk!/lib/x86, /data/app/ir.sep.sesoot-2/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at ir.sep.sesoot.ui.splash.ActivitySplash.onCreate(ActivitySplash.java:26)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Hi,
Thanks for the demo app and code, its really impressive.
I would like to know how did you those path information for those icons used in the demo app?
How to get or create svg path for any alphabet?
It appears that regardless of the height/width in dp the Animated SVG is always much smaller.
<com.jrummyapps.android.widget.AnimatedSvgView android:id="@+id/animated_svg_view" android:layout_width="300dp" android:layout_height="300dp" android:layout_gravity="center" app:animatedSvgFillColors="@array/canvas_logo_colors" app:animatedSvgFillStart="1200" app:animatedSvgFillTime="1000" app:animatedSvgGlyphStrings="@array/canvas_logo_paths" app:animatedSvgImageSizeX="400" app:animatedSvgImageSizeY="400" app:animatedSvgTraceTime="2000" app:animatedSvgTraceTimePerGlyph="1000" />
For example setting the view to 300dp it shows about 1/4 of the desired height/width. I also tried setting the viewportSize in code but that didn't help.
svgView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { svgView.getViewTreeObserver().removeOnGlobalLayoutListener(this); svgView.setViewportSize(svgView.getWidth(), svgView.getHeight()); } });
Any ideas on how to increase the AnimatedSvgView size?
The lib dont work with this image.
Crop the image.
File:
logo_stacked.zip
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey"
android:gravity="center"
android:orientation="vertical">
<com.jaredrummler.android.widget.AnimatedSvgView
android:id="@+id/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:animatedSvgFillColors="@array/logo_animate_colors"
app:animatedSvgFillStart="1200"
app:animatedSvgFillTime="1000"
app:animatedSvgGlyphStrings="@array/logo_animate_paths"
app:animatedSvgImageSizeX="118"
app:animatedSvgImageSizeY="68"
app:animatedSvgTraceTime="2000"
app:animatedSvgTraceTimePerGlyph="1000" />
</RelativeLayout>
First of all thanks for sharing such a great project.
The animation is perfect, just the kind I wanted.
But I have a problem
It would be nice if it were a simple SVG resource, but the SVG files I recently are a bit more complex,it even has hundreds of paths.
If I can only use the path array, I need to pull out each path.
I recently found a project that references SVG resources directly,(https://github.com/geftimov/android-pathview)
but his animation is not perfectly smooth,and that bro didn't have much time to fix it.
Forgive me, I'm still a noob.(wry smile)
So I would like to ask if you can directly refer to SVG in future updates,
That would be great.
My English is terrible,I don't know if you can read my description.
Ha ha.
Finally, looking forward to your reply
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.