PatternPathMotion
public class PatternPathMotion extends PathMotion
A PathMotion that takes a Path pattern and applies it to the separation between two points. The starting point of the Path will be moved to the origin and the end point will be scaled and rotated so that it matches with the target end point.
This may be used in XML as an element inside a transition.
<changeBounds>
<patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
</changeBounds>Summary
Public constructors |
|---|
|
Constructs a PatternPathMotion with a straight-line pattern. |
PatternPathMotion(@NonNull Path patternPath)Creates a PatternPathMotion with the Path defining a pattern of motion between two coordinates. |
PatternPathMotion(@NonNull Context context, @NonNull AttributeSet attrs) |
Public methods |
|
|---|---|
@NonNull Path |
getPath(float startX, float startY, float endX, float endY)Provide a Path to interpolate between two points |
@NonNull Path |
Returns the Path defining a pattern of motion between two coordinates. |
void |
setPatternPath(@NonNull Path patternPath)Sets the Path defining a pattern of motion between two coordinates. |
Public constructors
PatternPathMotion
public PatternPathMotion()
Constructs a PatternPathMotion with a straight-line pattern.
PatternPathMotion
public PatternPathMotion(@NonNull Path patternPath)
Creates a PatternPathMotion with the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.
PatternPathMotion
public PatternPathMotion(@NonNull Context context, @NonNull AttributeSet attrs)
Public methods
getPath
public @NonNull Path getPath(float startX, float startY, float endX, float endY)
Provide a Path to interpolate between two points (startX, startY) and (endX, endY). This allows controlled curved motion along two dimensions.
| Parameters | |
|---|---|
float startX |
The x coordinate of the starting point. |
float startY |
The y coordinate of the starting point. |
float endX |
The x coordinate of the ending point. |
float endY |
The y coordinate of the ending point. |
getPatternPath
public @NonNull Path getPatternPath()
Returns the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.
setPatternPath
public void setPatternPath(@NonNull Path patternPath)
Sets the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.