Tag: animation

uiscrollview的问题setcontentoffsetanimation时不animation:设置为yes

这很奇怪,我想知道有没有人有任何想法? 我试图滚动一个UIScrollView来响应iPad上的一个button。 如果我做: CGPoint currentOff = scrollView.contentOffset; currentOff.x+=240; [scrollView setContentOffset:currentOff animated: NO]; 滚动视图跳转到所需的位置,但我希望它滚动。 但是,当我这样做的时候: CGPoint currentOff = scrollView.contentOffset; currentOff.x+=240; [scrollView setContentOffset:currentOff animated: YES]; 那么它什么都不做! 我有另一个滚动视图正常工作,并按预期响应setContentOffset:YES ,所以我很困惑。 任何关于为什么滚动可能不会发生的想法是最受欢迎的! 此外, – (void)scrollViewDidScroll:(UIScrollView *)sender在使用animated:YES时没有收到任何内容,但是当使用animated:NO被使用!

WPF淡出animation

当它变为可见时,我将如何使控制淡入/淡出。 以下是我的失败尝试: <Window x:Class="WadFileTester.Form1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="MyWindow" Title="WAD File SI Checker" Height="386" Width="563" WindowStyle="SingleBorderWindow" DragEnter="Window_DragEnter" DragLeave="Window_DragLeave" DragOver="Window_DragOver" Drop="Window_Drop" AllowDrop="True"> <Window.Resources> <Style TargetType="ListView" x:Key="animatedList"> <Style.Triggers> <DataTrigger Binding="{Binding Visibility}" Value="Visible"> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:5" /> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:5" /> </Storyboard> </BeginStoryboard> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> […]

无法在一个周期结束时停止animation

我正在制作一个CSSanimation,在这个animation中,我正在移动东西,并希望它停留在最后位置,直到用户将鼠标移开。 body { background: url('osx.jpg'); padding: 0; margin: 0; line-height: 60px; } @-webkit-keyframes item1 { 0% { bottom: -120px; left: 0px; } 10% { bottom: -40px; left: 10px; -webkit-transform: rotate(5deg); } 100% { bottom: -40px; left: 10px; -webkit-transform: rotate(5deg); } } @-webkit-keyframes item2 { 0% { bottom: -120px; left: 0px; } 10% { bottom: 60px; […]

最快的方式在iOS上做阴影?

QuartzCore .layer.shadow的吸收性能。 他们似乎需要每次改变时重新渲染,导致一切都滞后。 Coregraphics渐变(单向阴影) – 看起来不正确。 如果你的渐变从0.3阿尔法到0,它有一些奇怪的效果,你可以看到它停止。 这只是不好看,或自然。 也许它没有抖动,但我敢肯定,我听说核心graphics渐变是。 这很奇怪,我不知道。 Coregraphics阴影 – 需要一段时间才能渲染,但其他方面performance不错。 只是等待一个观点出现,因为它必须首先渲染阴影,这就是问题所在。 所以我一定会错过一些东西。 有没有另外一种方法看起来正确,并且在渲染时间和性能上都很快?

Android:使用ObjectAnimator将视图的分数值转换为视图的维度

看起来,旧的视图animation( translate , scale等)不再被AnimationInflater接受,至less在ICS中是如此。 我在4.0.4中阅读了它的代码,它明确地期望只有XML元素set , objectAnimator , animator 。 即使http://developer.android.com/guide/topics/resources/animation-resource.html上的文档继续包含视图animation,它们似乎也被弃用了。 尝试使用它们会导致,例如,错误java.lang.RuntimeException: Unknown animator name: translate 。 因此,有必要使用Android的ObjectAnimator 。 但是,它不接受与其自身或其父级(例如translationX宽度)相关联的维度的分数值,如旧视图animation以"75%p"的forms所做的那样。 在运行时手动构造ObjectAnimator ,通过编程获取Fragment的大小是不可行的,因为FragmentTransaction只接受由resid指定的声明animation。 我的目标是翻译屏幕上填满整个活动(我基本上是做两个片段之间的转换过渡)的片段。 这是现有的TranslationAnimation实现( slide_in_right.xml ,它与其对应的slide_out_left.xml由于某种原因没有在android.R.anim公开,因此我必须在我的代码库中复制它们): <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@android:integer/config_mediumAnimTime"/> </set> 我的API级别设置为14。 谢谢!

在转型过程中,让新的活动出现在老的后面

我想实现的是重写开始活动animation。 animation应该给人一种旧活动在新活动之上的印象,然后向下滑出屏幕以显示新活动。 我已经尝试了多种方式,如使用overridePendingTransition(startAnim, exitAnim)但问题是他们都在同一时间线animation。 所以overridePendingTransition(R.anim.hold, R.anim.exit_slide_down); 你永远不会看到退出animation,因为新的活动是最重要的。 这可以通过框架来实现吗?

以编程方式调整布局的大小(如animation)

我想调整我的活动中的一些布局。 这是主XML的代码: <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical" > <LinearLayout android:id="@+id/top" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#3ee3e3" > </LinearLayout> <LinearLayout android:id="@+id/middle" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> </LinearLayout> <LinearLayout android:id="@+id/bottom" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#fe51e6" > </LinearLayout> </LinearLayout> 正如你所看到的,顶部和底部的布局高度是0,中间的布局覆盖了所有的地方。 我想以编程方式减小中间布局大小,同时增加顶部和底部布局大小,直到所有布局具有相同的高度。 我希望它看起来像一个animation。 我该怎么做? 谢谢

倒转animation

我有一个ImageView,它被添加到布局时获得animation。 当它被删除,我想扭转相同的animation。 有没有办法在Android中反转animation而不重新编码它并颠倒参数?

JavaScript是否提供高分辨率计时器?

JavaScript是否提供高分辨率计时器? 我从零开始写了几个游戏引擎,一些用C语言编写,一些用Java用,一些用Flash。 当谈到animation和交互式graphics时,我总是遵循相同的基本模型。 用下面的devise创build一个基本的类/结构: void init() { /* Called once, preload essential resources here. */ } void update(double time) { /* Updates game/animation state using high resolution time. */ } void render(double time) { /* Updates screen graphics using high resolution time. */ } void run() { double time; init(); while (!done) { time = […]

如何实现RecyclerView的ItemAnimator来禁用notifyItemChanged的animation

在我的项目中,我需要禁用RecyclerView的“更改”animation,而notifyItemChanged 。 我调查了RecyclerView的源代码,并重写了android.support.v7.widget.DefaultItemAnimator ,如下所示: private static class ItemAnimator extends DefaultItemAnimator { @Override public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, int fromX, int fromY, int toX, int toY) { if(oldHolder != null) { oldHolder.itemView.setVisibility(View.INVISIBLE); dispatchChangeFinished(oldHolder, true); } if(newHolder != null) { dispatchChangeFinished(newHolder, false); } return false; } } 但我不确定是否符合Google文档的规格: RecyclerView.ItemAnimator.animateChange 根据我对源代码的理解,如果我没有正确地覆盖这个方法,oldHolder 将不会被回收。 请帮我弄清楚如何以正确的方式覆盖animateChange 。