builder.pathData(pathData); if (animationMap != null && animationMap.containsKey("pathData")) { builder.pathData((Animation<?, PathData>[]) animationMap.get("pathData")); builder.fillColor( TypedArrayUtils.getNamedColor( a, parser, "fillColor", Styleable.Path.FILL_COLOR, Color.TRANSPARENT)); if (animationMap != null && animationMap.containsKey("fillColor")) { builder.fillColor((Animation<?, Integer>[]) animationMap.get("fillColor")); builder.fillAlpha( TypedArrayUtils.getNamedFloat(a, parser, "fillAlpha", Styleable.Path.FILL_ALPHA, 1)); if (animationMap != null && animationMap.containsKey("fillAlpha")) { builder.fillAlpha((Animation<?, Float>[]) animationMap.get("fillAlpha")); builder.strokeColor( TypedArrayUtils.getNamedColor( a, parser, "strokeColor", Styleable.Path.STROKE_COLOR, Color.TRANSPARENT)); if (animationMap != null && animationMap.containsKey("strokeColor")) { builder.strokeColor((Animation<?, Integer>[]) animationMap.get("strokeColor")); builder.strokeAlpha( TypedArrayUtils.getNamedFloat(a, parser, "strokeAlpha", Styleable.Path.STROKE_ALPHA, 1)); if (animationMap != null && animationMap.containsKey("strokeAlpha")) { builder.strokeAlpha((Animation<?, Float>[]) animationMap.get("strokeAlpha")); builder.strokeWidth( TypedArrayUtils.getNamedFloat(a, parser, "strokeWidth", Styleable.Path.STROKE_WIDTH, 0)); if (animationMap != null && animationMap.containsKey("strokeWidth")) {
@SafeVarargs public final Builder pathData(Animation<?, PathData>... animations) { return replaceAnimations(pathData, animations); }
.child( PathNode.builder() .strokeColor(Color.BLACK) .strokeWidth(1f) .fillColor( Animation.ofArgb(hippoFillColor, elephantFillColor).duration(300), Animation.ofArgb(buffaloFillColor).startDelay(600).duration(300), Animation.ofArgb(hippoFillColor).startDelay(1200).duration(300)) .pathData( Animation.ofPathMorph( Keyframe.of(0, hippoPathData),
private KyrieDrawable createLapsDrawable() { final KyrieDrawable.Builder builder = KyrieDrawable.builder().viewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); for (Polygon polygon : polygons) { builder.child( PathNode.builder() .pathData(PathData.parse(polygon.pathData)) .strokeWidth(4f) .strokeColor(polygon.color)); } for (Polygon polygon : polygons) { final PathData pathData = PathData.parse(TextUtils.join(" ", Collections.nCopies(polygon.laps, polygon.pathData))); final Animation<PointF, PointF> pathMotion = Animation.ofPathMotion(PathData.toPath(pathData)) .repeatCount(Animation.INFINITE) .duration(DURATION); builder.child( CircleNode.builder() .fillColor(Color.BLACK) .radius(8) .centerX(pathMotion.transform(p -> p.x)) .centerY(pathMotion.transform(p -> p.y))); } return builder.build(); }
private KyrieDrawable createVortexDrawable() { final KyrieDrawable.Builder builder = KyrieDrawable.builder().viewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); for (Polygon polygon : polygons) { final float length = polygon.length; final float totalLength = length * polygon.laps; builder.child( PathNode.builder() .pathData(PathData.parse(polygon.pathData)) .strokeWidth(4f) .strokeColor(polygon.color) .strokeDashArray( Animation.ofFloatArray(new float[] {0, length}, new float[] {length, 0}) .repeatCount(Animation.INFINITE) .duration(DURATION)) .strokeDashOffset( Animation.ofFloat(0f, 2 * totalLength) .repeatCount(Animation.INFINITE) .duration(DURATION))); } return builder.build(); }
public Builder pathData(List<Animation<?, PathData>> animations) { return replaceAnimations(pathData, animations); }
public Builder pathData(PathData initialPathData) { return replaceFirstAnimation(pathData, asAnimation(initialPathData)); }
public static Builder builder() { return new Builder(); }
public Builder pathData(String initialPathData) { return pathData(PathData.parse(initialPathData)); }