1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.support.transition; 18 19import android.content.Context; 20import android.graphics.Path; 21import android.util.AttributeSet; 22 23/** 24 * This base class can be extended to provide motion along a Path to Transitions. 25 * 26 * <p> 27 * Transitions such as {@link android.transition.ChangeBounds} move Views, typically 28 * in a straight path between the start and end positions. Applications that desire to 29 * have these motions move in a curve can change how Views interpolate in two dimensions 30 * by extending PathMotion and implementing {@link #getPath(float, float, float, float)}. 31 * </p> 32 * <p>This may be used in XML as an element inside a transition.</p> 33 * <pre> 34 * {@code 35 * <changeBounds> 36 * <pathMotion class="my.app.transition.MyPathMotion"/> 37 * </changeBounds> 38 * } 39 * </pre> 40 */ 41public abstract class PathMotion { 42 43 public PathMotion() { 44 } 45 46 public PathMotion(Context context, AttributeSet attrs) { 47 } 48 49 /** 50 * Provide a Path to interpolate between two points <code>(startX, startY)</code> and 51 * <code>(endX, endY)</code>. This allows controlled curved motion along two dimensions. 52 * 53 * @param startX The x coordinate of the starting point. 54 * @param startY The y coordinate of the starting point. 55 * @param endX The x coordinate of the ending point. 56 * @param endY The y coordinate of the ending point. 57 * @return A Path along which the points should be interpolated. The returned Path 58 * must start at point <code>(startX, startY)</code>, typically using 59 * {@link android.graphics.Path#moveTo(float, float)} and end at <code>(endX, endY)</code>. 60 */ 61 public abstract Path getPath(float startX, float startY, float endX, float endY); 62} 63