Когда вы добавляете элемент в список чтения, я пытаюсь сделать эффект анимации похожим на тот, который включен в Safari (iPhone). Он похож на тот, который появляется при загрузке элемента из приложения App Store: элемент приложения падает в док-станцию, чтобы начать загрузку. Сначала он подпрыгивает, а затем идет к пристани. Это очень хороший эффект, который Apple использует в своей ОС.
У меня есть изображение на экране, которое я хочу отбросить с помощью этой анимации на мою панель инструментов в своем приложении.
Если есть кто-то, кто это сделал или знает, как называется эффект, можете рассказать мне, как это сделать.
Спасибо.
«Добавить в список чтения» не отображает анимацию на моем телефоне, но из вашего описания это похоже на «Открыть в фоновом режиме» -анимация в Safari (iPhone). Мой ответ описывает эту анимацию.
Я написал такую вещь несколько месяцев назад, и многое из этого выполнимо, а некоторые - нет. Ваши вопросы показали мне, что больше людей должны знать, как это делается, create a new layer and draw the content of your layer into an image and set that image as the content of the layer that you are animating
The start position of the animation is simply the frame of the view. The end position is very tricky since bar items (both tool bar items and tab bar items) are not UIView subclasses and doesn't have a public view property. This causes problems when you want to shake the bar item later on.
Я решил сделать визуальное приближение конечной позиции, используя некоторые простые эвристики. Если вы знаете перед рукой, что вы будете анимировать только один элемент, тогда конечная позиция может быть жестко закодирована в подходящий кадр.
There is nothing special to moving, scaling and rotating the layer from the start to the end position. If you want to read more about how I did it you can look at the post I wrote.
This cannot be done without a lot of custom code or using private API at the moment. Since bar items doesn't have a view or a layer there is no accessible layer for you to animate. I guess that you could have a custom animating image that does the shake and set that during the animation and set the new image afterwards. The approach of drawing into an image and animating that doesn't work that well either since there is no accessible layer who can draw its content into the image (you want this for the special effect of the tool bar item and tab bar item).