Tag: animation

如何使用requestAnimationFrame?

我是新来的animation,但我最近使用setTimeout创build了一个animation。 FPS太低,所以我find了一个解决scheme,使用requestAnimationFrame ,在这个链接中描述。 到目前为止,我的代码是: //shim layer with setTimeout fallback window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback){ window.setTimeout(callback, 1000 / 60); }; })(); (function animloop(){ //Get metrics var leftCurveEndX = finalLeft – initialLeft; var leftCurveEndY = finalTop + finalHeight – initialTop; var rightCurveEndX = finalLeft […]

addSubviewanimation

我有主UIView我显示不同的数据。 然后我把一个button,它显示子视图像这样: – (IBAction) buttonClicked:(id)sender { UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(25,25,50,20)]; UILabel *newLabel = [[UILabel alloc] initWithFrame:CGRectMake(25,25,50,25)]; newLabel.text = @"some text"; [newView addSubview:newLabel]; [self.view addSubview:newView]; [newLabel release]; [newView release]; } newView显示正常,但它不会以任何方式进行animation,它只是立即出现。 如何在newView出现时添加某种animation? 像缩放或向下滑动或类似的东西。 有一些简单的代码?

Android视图消失时,出去家长

我在这个LinearLayout中有一个LinearLayout和ImageView。 ImageView有翻译效果。 // v = ImageView ObjectAnimator animation2 = ObjectAnimator.ofFloat(v, "translationY", 200); animation2.setDuration(3000); animation2.setTarget(v); animation2.start(); animation工作,但当ImageView走出LinearLayout时,它正在消失。 你可以在这里看到问题: http : //screenr.com/zoAH 我怎样才能修复它,而不修改LinearLayout的高度。

AngularJS – animationng视图转换

我有2个html页面, welcome.html和login.html ,这两个页面都通过ngview属性和路由器提供程序 “插入” index.html依赖的URL,作为我的AngularJS应用程序的一部分。 这个例子可以在Wire up a Backend下的AngularJS主页上find。 我的问题 :是否有一种方法来使welcome.html和login.html之间的过渡动​​画?

animation片段和后面的堆栈

我无法使用或理解如何popupFragmentTransactions退后堆栈处理自定义animation。 具体来说,我希望它叫“出”animation,但似乎并不如此。 我有一个简单的方法来处理一个片段事务(FragmentTransaction),我添加一个片段,并应用自定义的过渡,以便它淡入/淡出。 我也将这添加到后退堆栈,以便用户可以使用后退button撤消该事务,实质上导航到添加片段之前的状态。 protected void changeFragment() { FragmentTransaction ft = fm.beginTransaction(); ft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out); ft.add(R.id.fragment_container, new TestFragment()); ft.addToBackStack(null); ft.commit(); } 一切都很顺利,但是当用户点击后退button时,转换animation不会反转。 我期望的是,当片段被删除,它会使用淡出animation。 相反,它似乎popup(没有animation),然后容器似乎淡入。我不知道这正是发生的事情,但片段绝对不是淡出。 我的应用程序使用兼容性库来添加片段支持,但是我认为这也适用于Honeycomb(android-11)。 有谁知道我是否只是在这里做错了什么,或者如果我只是期待太多? 理想的情况下,我想animation的片段类似于(通过Xoom)Gmail如何通过点击一条消息,然后使用后退button向前移动。 最好不必重写后退button的function,并跟上我自己的片段状态,因为我可以有几个“交易”,我想退出,我不是重新发明车轮的粉丝。 另请向Android开发者小组提问: http : //groups.google.com/group/android-developers/browse_thread/thread/1136a3a70fa0b6e9

如何取消UIView基于块的animation?

我search了大量的东西,并在苹果的参考,但仍然无法pipe理我的问题。 我拥有的: 2 UIImageViews与他们连接2 UIButtons屏幕 2种animation: 2.1。 第一个是放大,然后在每个图像,一个接一个,只有一次viewDidLoad 2.2。 第二个,当按下button时(这是自定义button,隐藏在每个UIImageView的“内部”),它触发适当的UIImageViewanimation – 只有一个,而不是两个 – (也放大,然后下来)。 正如我为iOS4 +写的,我被告知使用基于块的animation! 我需要的: 如何取消正在运行的animation? 我设法取消所有,但最后一个…:/这是我的代码片段: [UIImageView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionAllowUserInteraction animations:^{ isAnimating = YES; self.bigLetter.transform = CGAffineTransformScale(self.bigLetter.transform, 2.0, 2.0); } completion:^(BOOL finished){ if(! finished) return; [UIImageView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ self.bigLetter.transform = CGAffineTransformScale(self.bigLetter.transform, 0.5, 0.5); } completion:^(BOOL finished){ if(! finished) return; [UIImageView […]

删除所有CALayer的子层

我在删除图层的所有子图层时遇到了问题。 我目前手动执行此操作,但会带来不必要的混乱。 我在google上发现了很多这方面的话题,但是没有答案。 我试图做这样的事情: 用于(rootLayer.sublayers中的CALayer *图层) { [layer removeFromSublayer]; } 但它没有工作。 此外,我试图将rootLayer.sublayers克隆到单独的NSArray,但结果是相同的。 有任何想法吗? 编辑: 我认为现在可行,但我错了。 它适用于CALayers,但它不适用于CATextLayers。 有任何想法吗?

视图animation之后为什么不设置可见性?

为什么textView不可见? 这是我的布局xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/tvRotate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rotate Me" /> </LinearLayout> ..这是我的活动: public class RotateMeActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tvRotate = (TextView) findViewById(R.id.tvRotate); RotateAnimation r = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); r.setDuration(0); r.setFillAfter(true); tvRotate.startAnimation(r); tvRotate.setVisibility(View.INVISIBLE); } } […]

圆形显示新活动的过渡

按照https://developer.android.com/training/material/animations.html ViewAnimationUtils.createCircularReveal()方法使您可以animation剪辑圈来显示或隐藏视图。 使用这个效果来揭示以前不可见的视图: // previously invisible view View myView = findViewById(R.id.my_view); // get the center for the clipping circle int cx = (myView.getLeft() + myView.getRight()) / 2; int cy = (myView.getTop() + myView.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(myView.getWidth(), myView.getHeight()); // create the animator for this […]

Angular-animate – 未知的提供者:$$ asyncCallbackProvider < – $$ asyncCallback < – $ animate < – $ compile

我有一个奇怪的问题。 我想在我的AngularJS项目中包含angular-animate – 我正在使用AngularJS v1.2.6。 我已经添加了angular-animate到我的凉亭文件。 它已经下载并添加到我的源文件中的HTML文件,它指向正确的文件(它加载在浏览器中)。 现在我需要添加这个作为依赖,所以我添加模块到我的应用程序… angular.module('myApp', [ 'ngResource', 'ngSanitize', 'ngRoute', 'ui.bootstrap', 'LocalStorageModule', 'cookiesModule', 'ngAnimate' ]) 然而,只要Grunt开始检测文件的变化,并build立我得到以下错误: Unknown provider: $$asyncCallbackProvider <- $$asyncCallback <- $animate <- $compile 我检查拼写,我已经按照https://github.com/angular/bower-angular-animate上提到的说明,但我不明白为什么这不起作用或为什么我得到错误! 我已经改变了依赖数组中依赖的位置,但是这没有任何作用。 有没有人经历过这个? 我会继续研究这个,但如果有人已经克服或确定为什么发生这种情况,请说出来! 提前致谢