John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 17 | #include "Animator.h" |
| 18 | |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 19 | #include <inttypes.h> |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 20 | #include <set> |
| 21 | |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 22 | #include "RenderNode.h" |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 23 | #include "RenderProperties.h" |
| 24 | |
| 25 | namespace android { |
| 26 | namespace uirenderer { |
| 27 | |
| 28 | /************************************************************ |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 29 | * BaseRenderNodeAnimator |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 30 | ************************************************************/ |
| 31 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 32 | BaseRenderNodeAnimator::BaseRenderNodeAnimator(float finalValue) |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 33 | : mTarget(NULL) |
| 34 | , mFinalValue(finalValue) |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 35 | , mDeltaValue(0) |
| 36 | , mFromValue(0) |
| 37 | , mInterpolator(0) |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 38 | , mStagingPlayState(NOT_STARTED) |
| 39 | , mPlayState(NOT_STARTED) |
| 40 | , mHasStartValue(false) |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 41 | , mStartTime(0) |
Alan Viverette | ad2f8e3 | 2014-05-16 13:28:33 -0700 | [diff] [blame] | 42 | , mDuration(300) |
| 43 | , mStartDelay(0) { |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 44 | } |
| 45 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 46 | BaseRenderNodeAnimator::~BaseRenderNodeAnimator() { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 47 | delete mInterpolator; |
| 48 | } |
| 49 | |
| 50 | void BaseRenderNodeAnimator::checkMutable() { |
| 51 | // Should be impossible to hit as the Java-side also has guards for this |
| 52 | LOG_ALWAYS_FATAL_IF(mStagingPlayState != NOT_STARTED, |
| 53 | "Animator has already been started!"); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 54 | } |
| 55 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 56 | void BaseRenderNodeAnimator::setInterpolator(Interpolator* interpolator) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 57 | checkMutable(); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 58 | delete mInterpolator; |
| 59 | mInterpolator = interpolator; |
| 60 | } |
| 61 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 62 | void BaseRenderNodeAnimator::setStartValue(float value) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 63 | checkMutable(); |
| 64 | doSetStartValue(value); |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 65 | } |
| 66 | |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 67 | void BaseRenderNodeAnimator::doSetStartValue(float value) { |
| 68 | mFromValue = value; |
| 69 | mDeltaValue = (mFinalValue - mFromValue); |
| 70 | mHasStartValue = true; |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Alan Viverette | ad2f8e3 | 2014-05-16 13:28:33 -0700 | [diff] [blame] | 73 | void BaseRenderNodeAnimator::setDuration(nsecs_t duration) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 74 | checkMutable(); |
Alan Viverette | ad2f8e3 | 2014-05-16 13:28:33 -0700 | [diff] [blame] | 75 | mDuration = duration; |
| 76 | } |
| 77 | |
| 78 | void BaseRenderNodeAnimator::setStartDelay(nsecs_t startDelay) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 79 | checkMutable(); |
Alan Viverette | ad2f8e3 | 2014-05-16 13:28:33 -0700 | [diff] [blame] | 80 | mStartDelay = startDelay; |
| 81 | } |
| 82 | |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 83 | void BaseRenderNodeAnimator::attach(RenderNode* target) { |
| 84 | mTarget = target; |
| 85 | onAttached(); |
| 86 | } |
| 87 | |
| 88 | void BaseRenderNodeAnimator::pushStaging(TreeInfo& info) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 89 | if (!mHasStartValue) { |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 90 | doSetStartValue(getValue(mTarget)); |
Alan Viverette | ad2f8e3 | 2014-05-16 13:28:33 -0700 | [diff] [blame] | 91 | } |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 92 | if (mStagingPlayState > mPlayState) { |
| 93 | mPlayState = mStagingPlayState; |
| 94 | // Oh boy, we're starting! Man the battle stations! |
| 95 | if (mPlayState == RUNNING) { |
| 96 | transitionToRunning(info); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 97 | } |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 98 | } |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | void BaseRenderNodeAnimator::transitionToRunning(TreeInfo& info) { |
| 102 | LOG_ALWAYS_FATAL_IF(info.frameTimeMs <= 0, "%" PRId64 " isn't a real frame time!", info.frameTimeMs); |
| 103 | if (mStartDelay < 0 || mStartDelay > 50000) { |
| 104 | ALOGW("Your start delay is strange and confusing: %" PRId64, mStartDelay); |
| 105 | } |
| 106 | mStartTime = info.frameTimeMs + mStartDelay; |
| 107 | if (mStartTime < 0) { |
| 108 | ALOGW("Ended up with a really weird start time of %" PRId64 |
| 109 | " with frame time %" PRId64 " and start delay %" PRId64, |
| 110 | mStartTime, info.frameTimeMs, mStartDelay); |
| 111 | // Set to 0 so that the animate() basically instantly finishes |
| 112 | mStartTime = 0; |
| 113 | } |
| 114 | // No interpolator was set, use the default |
| 115 | if (!mInterpolator) { |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 116 | mInterpolator = Interpolator::createDefaultInterpolator(); |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 117 | } |
| 118 | if (mDuration < 0 || mDuration > 50000) { |
| 119 | ALOGW("Your duration is strange and confusing: %" PRId64, mDuration); |
| 120 | } |
| 121 | } |
| 122 | |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 123 | bool BaseRenderNodeAnimator::animate(TreeInfo& info) { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 124 | if (mPlayState < RUNNING) { |
| 125 | return false; |
| 126 | } |
John Reck | 32fb630 | 2014-07-07 09:50:32 -0700 | [diff] [blame] | 127 | if (mPlayState == FINISHED) { |
| 128 | return true; |
| 129 | } |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 130 | |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 131 | // If BaseRenderNodeAnimator is handling the delay (not typical), then |
| 132 | // because the staging properties reflect the final value, we always need |
| 133 | // to call setValue even if the animation isn't yet running or is still |
| 134 | // being delayed as we need to override the staging value |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 135 | if (mStartTime > info.frameTimeMs) { |
| 136 | info.out.hasAnimations |= true; |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 137 | setValue(mTarget, mFromValue); |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 138 | return false; |
| 139 | } |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 140 | |
| 141 | float fraction = 1.0f; |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 142 | if (mPlayState == RUNNING && mDuration > 0) { |
| 143 | fraction = (float)(info.frameTimeMs - mStartTime) / mDuration; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 144 | } |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 145 | if (fraction >= 1.0f) { |
| 146 | fraction = 1.0f; |
| 147 | mPlayState = FINISHED; |
| 148 | } |
| 149 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 150 | fraction = mInterpolator->interpolate(fraction); |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 151 | setValue(mTarget, mFromValue + (mDeltaValue * fraction)); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 152 | |
| 153 | if (mPlayState == FINISHED) { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 154 | callOnFinishedListener(info); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 155 | return true; |
| 156 | } |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 157 | |
| 158 | info.out.hasAnimations |= true; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 159 | return false; |
| 160 | } |
| 161 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 162 | void BaseRenderNodeAnimator::callOnFinishedListener(TreeInfo& info) { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 163 | if (mListener.get()) { |
| 164 | if (!info.animationHook) { |
| 165 | mListener->onAnimationFinished(this); |
| 166 | } else { |
| 167 | info.animationHook->callOnFinished(this, mListener.get()); |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | /************************************************************ |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 173 | * RenderPropertyAnimator |
| 174 | ************************************************************/ |
| 175 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 176 | struct RenderPropertyAnimator::PropertyAccessors { |
| 177 | RenderNode::DirtyPropertyMask dirtyMask; |
| 178 | GetFloatProperty getter; |
| 179 | SetFloatProperty setter; |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 180 | }; |
| 181 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 182 | // Maps RenderProperty enum to accessors |
| 183 | const RenderPropertyAnimator::PropertyAccessors RenderPropertyAnimator::PROPERTY_ACCESSOR_LUT[] = { |
| 184 | {RenderNode::TRANSLATION_X, &RenderProperties::getTranslationX, &RenderProperties::setTranslationX }, |
| 185 | {RenderNode::TRANSLATION_Y, &RenderProperties::getTranslationY, &RenderProperties::setTranslationY }, |
| 186 | {RenderNode::TRANSLATION_X, &RenderProperties::getTranslationZ, &RenderProperties::setTranslationZ }, |
| 187 | {RenderNode::SCALE_X, &RenderProperties::getScaleX, &RenderProperties::setScaleX }, |
| 188 | {RenderNode::SCALE_Y, &RenderProperties::getScaleY, &RenderProperties::setScaleY }, |
| 189 | {RenderNode::ROTATION, &RenderProperties::getRotation, &RenderProperties::setRotation }, |
| 190 | {RenderNode::ROTATION_X, &RenderProperties::getRotationX, &RenderProperties::setRotationX }, |
| 191 | {RenderNode::ROTATION_Y, &RenderProperties::getRotationY, &RenderProperties::setRotationY }, |
| 192 | {RenderNode::X, &RenderProperties::getX, &RenderProperties::setX }, |
| 193 | {RenderNode::Y, &RenderProperties::getY, &RenderProperties::setY }, |
| 194 | {RenderNode::Z, &RenderProperties::getZ, &RenderProperties::setZ }, |
| 195 | {RenderNode::ALPHA, &RenderProperties::getAlpha, &RenderProperties::setAlpha }, |
| 196 | }; |
| 197 | |
| 198 | RenderPropertyAnimator::RenderPropertyAnimator(RenderProperty property, float finalValue) |
| 199 | : BaseRenderNodeAnimator(finalValue) |
| 200 | , mPropertyAccess(&(PROPERTY_ACCESSOR_LUT[property])) { |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 201 | } |
| 202 | |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 203 | void RenderPropertyAnimator::onAttached() { |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 204 | if (!mHasStartValue |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 205 | && mTarget->isPropertyFieldDirty(mPropertyAccess->dirtyMask)) { |
| 206 | setStartValue((mTarget->stagingProperties().*mPropertyAccess->getter)()); |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 207 | } |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | void RenderPropertyAnimator::onStagingPlayStateChanged() { |
| 211 | if (mStagingPlayState == RUNNING) { |
| 212 | (mTarget->mutateStagingProperties().*mPropertyAccess->setter)(finalValue()); |
John Reck | 32fb630 | 2014-07-07 09:50:32 -0700 | [diff] [blame] | 213 | } else if (mStagingPlayState == FINISHED) { |
| 214 | // We're being canceled, so make sure that whatever values the UI thread |
| 215 | // is observing for us is pushed over |
| 216 | mTarget->setPropertyFieldsDirty(dirtyMask()); |
John Reck | 8d8af3c | 2014-07-01 15:23:45 -0700 | [diff] [blame] | 217 | } |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 218 | } |
| 219 | |
John Reck | 2218472 | 2014-06-20 07:19:30 -0700 | [diff] [blame] | 220 | uint32_t RenderPropertyAnimator::dirtyMask() { |
| 221 | return mPropertyAccess->dirtyMask; |
| 222 | } |
| 223 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 224 | float RenderPropertyAnimator::getValue(RenderNode* target) const { |
| 225 | return (target->properties().*mPropertyAccess->getter)(); |
| 226 | } |
| 227 | |
| 228 | void RenderPropertyAnimator::setValue(RenderNode* target, float value) { |
| 229 | (target->animatorProperties().*mPropertyAccess->setter)(value); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 230 | } |
| 231 | |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 232 | /************************************************************ |
| 233 | * CanvasPropertyPrimitiveAnimator |
| 234 | ************************************************************/ |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 235 | |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 236 | CanvasPropertyPrimitiveAnimator::CanvasPropertyPrimitiveAnimator( |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 237 | CanvasPropertyPrimitive* property, float finalValue) |
| 238 | : BaseRenderNodeAnimator(finalValue) |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 239 | , mProperty(property) { |
| 240 | } |
| 241 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 242 | float CanvasPropertyPrimitiveAnimator::getValue(RenderNode* target) const { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 243 | return mProperty->value; |
| 244 | } |
| 245 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 246 | void CanvasPropertyPrimitiveAnimator::setValue(RenderNode* target, float value) { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 247 | mProperty->value = value; |
| 248 | } |
| 249 | |
John Reck | a7c2ea2 | 2014-08-08 13:21:00 -0700 | [diff] [blame] | 250 | uint32_t CanvasPropertyPrimitiveAnimator::dirtyMask() { |
| 251 | return RenderNode::DISPLAY_LIST; |
| 252 | } |
| 253 | |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 254 | /************************************************************ |
| 255 | * CanvasPropertySkPaintAnimator |
| 256 | ************************************************************/ |
| 257 | |
| 258 | CanvasPropertyPaintAnimator::CanvasPropertyPaintAnimator( |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 259 | CanvasPropertyPaint* property, PaintField field, float finalValue) |
| 260 | : BaseRenderNodeAnimator(finalValue) |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 261 | , mProperty(property) |
| 262 | , mField(field) { |
| 263 | } |
| 264 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 265 | float CanvasPropertyPaintAnimator::getValue(RenderNode* target) const { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 266 | switch (mField) { |
| 267 | case STROKE_WIDTH: |
| 268 | return mProperty->value.getStrokeWidth(); |
| 269 | case ALPHA: |
| 270 | return mProperty->value.getAlpha(); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 271 | } |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 272 | LOG_ALWAYS_FATAL("Unknown field %d", (int) mField); |
| 273 | return -1; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 274 | } |
| 275 | |
John Reck | 531ee70 | 2014-05-13 10:06:08 -0700 | [diff] [blame] | 276 | static uint8_t to_uint8(float value) { |
| 277 | int c = (int) (value + .5f); |
| 278 | return static_cast<uint8_t>( c < 0 ? 0 : c > 255 ? 255 : c ); |
| 279 | } |
| 280 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 281 | void CanvasPropertyPaintAnimator::setValue(RenderNode* target, float value) { |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 282 | switch (mField) { |
| 283 | case STROKE_WIDTH: |
| 284 | mProperty->value.setStrokeWidth(value); |
| 285 | return; |
| 286 | case ALPHA: |
John Reck | 531ee70 | 2014-05-13 10:06:08 -0700 | [diff] [blame] | 287 | mProperty->value.setAlpha(to_uint8(value)); |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 288 | return; |
| 289 | } |
| 290 | LOG_ALWAYS_FATAL("Unknown field %d", (int) mField); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 291 | } |
| 292 | |
John Reck | a7c2ea2 | 2014-08-08 13:21:00 -0700 | [diff] [blame] | 293 | uint32_t CanvasPropertyPaintAnimator::dirtyMask() { |
| 294 | return RenderNode::DISPLAY_LIST; |
| 295 | } |
| 296 | |
Chris Craik | af4d04c | 2014-07-29 12:50:14 -0700 | [diff] [blame] | 297 | RevealAnimator::RevealAnimator(int centerX, int centerY, |
John Reck | d3de42c | 2014-07-15 14:29:33 -0700 | [diff] [blame] | 298 | float startValue, float finalValue) |
| 299 | : BaseRenderNodeAnimator(finalValue) |
| 300 | , mCenterX(centerX) |
Chris Craik | af4d04c | 2014-07-29 12:50:14 -0700 | [diff] [blame] | 301 | , mCenterY(centerY) { |
John Reck | d3de42c | 2014-07-15 14:29:33 -0700 | [diff] [blame] | 302 | setStartValue(startValue); |
| 303 | } |
| 304 | |
| 305 | float RevealAnimator::getValue(RenderNode* target) const { |
Chris Craik | af4d04c | 2014-07-29 12:50:14 -0700 | [diff] [blame] | 306 | return target->properties().getRevealClip().getRadius(); |
John Reck | d3de42c | 2014-07-15 14:29:33 -0700 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | void RevealAnimator::setValue(RenderNode* target, float value) { |
Chris Craik | af4d04c | 2014-07-29 12:50:14 -0700 | [diff] [blame] | 310 | target->animatorProperties().mutableRevealClip().set(true, |
John Reck | d3de42c | 2014-07-15 14:29:33 -0700 | [diff] [blame] | 311 | mCenterX, mCenterY, value); |
| 312 | } |
| 313 | |
John Reck | a7c2ea2 | 2014-08-08 13:21:00 -0700 | [diff] [blame] | 314 | uint32_t RevealAnimator::dirtyMask() { |
| 315 | return RenderNode::GENERIC; |
| 316 | } |
| 317 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 318 | } /* namespace uirenderer */ |
| 319 | } /* namespace android */ |