我可以在离子框架视图中创建简单的动画。动画将是非常简单的动画,比如改变颜色,褪色,增加元素的高度和宽度,就像jquery在网页中做的动画一样。离子框架中的简单动画
回答
是的。离子中没有任何东西会阻止这一点。你真的尝试过吗?或者你问是否Ionic 运送这样的东西?据我所知,答案是否定的。
离子动画与您在标准html页面上的动画一样,唯一的区别是如何设置它的角度。
它在分配给视图的控制器中,您可以添加您的代码。
.controller('homeCtrl', ['$scope', function($scope) {
// Jquery animation
$(selector).animate({params},speed,callback);
// Greensock animation
var photo = document.getElementById("photo"); //or use jQuery's $("#photo")
TweenLite.to(photo, 1.5, {width:100});
// or define a function and call it when you want an animation to run
$scope.animate = function(element) {
$(element).animate({params},speed,callback);
}
}])
这就是它的要点,你可以看看更详细的东西上YearOfMoo
那么你是否提供了添加Greensock或jQuery以及Ionic Framework的建议?这是否复制了已经嵌入到Ionic Framework中的用于处理动画的代码?将动画操作和触发器添加到指令而不是控制器中是不是更好的做法? – BrightIntelDusk 2015-01-27 20:25:43
我不推荐任何事情,除了我当时解决我的问题,并且它对我来说非常出色:) Ionic没有Greensock提供的动画功能,但Moo年显示如何将它整合到角度中它非常适合我的项目。 – CaptRisky 2015-02-01 13:30:21
是的,你可以对这个看看。
一个功能强大的JavaScript动画引擎,适用于web和混合移动应用程序,受Facebook Pop的启发,由Ionic团队构建。
https://github.com/driftyco/collide
var animation = collide.animation({
// 'linear|ease|ease-in|ease-out|ease-in-out|cubic-bezer(x1,y1,x2,y2)',
// or function(t, duration),
// or a dynamics configuration (see below)
easing: 'ease-in-out',
duration: 1000,
percent: 0,
reverse: false
});
// Actions, all of these return `this` and are chainable
// .on('step' callback is given a 'percent', 0-1, as argument (for springs it could be outside 0-1 range)
// .on('stop' callback is given a boolean, wasCompleted
animation.on(/step|destroy|start|stop|complete/, function() {})
animation.once(...) //same event types
animation.off(...) //works like jquery.off
animation.stop(); //stop/pause at current position
animation.start(shouldSetImmediately); //start from current position
animation.restart();
animation.velocity(n) //starts the animation going at the given velocity ,relative to the distance, decaying
animation.distance(n); //distance for the velocity to be relative to
animation.destroy(); //unbind all events & deallocate
animation.isRunning(); //boolean getter
//These are getters and setters.
//No arguments is a getter, argument is a chainable setter.
animation.percent(newPercent, shouldSetImmediately); //0-1
animation.duration(duration); //milliseconds
animation.reverse(isReverse);
animation.easing(easing); //setter, string|function(t,duration)|dynamicsConfiguration.
// Dynamics configuration looks like this one of these:
// animation.easing({
// type: 'spring',
// frequency: 15,
// friction: 200,
// initialForce: false
// });
// animation.easing({
// type: 'gravity',
// bounce: 40,
// gravity: 1000,
// });
你知道我在哪里可以找到这个API在Ionic App中使用的例子吗?这个代码是否会添加到指令中? – BrightIntelDusk 2015-01-27 20:26:19
在回购中给出了一个示例,请参阅* test.html *:https://github.com/driftyco/collide/blob/master/test.html – AAhad 2015-01-28 05:07:48
- 1. Cocos2d V3中的简单动画框架
- 2. 动画到离子框架中的收集 - 重复项目
- 3. 在离子框架中构建一个闪屏动画?
- 4. 如何使用离子框架来制作简单的http Post?
- 5. 用于Java中简单2D动画的框架/库?
- 6. 离子框架:取决于操作系统的条件动画
- 7. ChartJs在离子框架中
- 8. 对离子框架
- 9. 离子框架表单生成
- 10. Java离子后台离子框架
- 11. 离子框架的安装
- 12. 离子框架 - 的Config.xml
- 13. 。jquery中的动画框架
- 14. Android中的框架动画?
- 15. 不能动画子视图的框架
- 16. XAML中的简单动画书动画
- 17. Sqlite离子框架活动会话
- 18. zend框架简单的动作问题
- 19. WinForms中的简单动画
- 20. Java中的简单动画
- 21. jQuery的单页动画框架
- 22. 简单的动画
- 23. 离子框架中的URL错误
- 24. 获取Angularjs /离子框架
- 25. 离子框架FCM插件
- 26. Sidemenus在离子框架
- 27. 离子框架 - 使用$ ionicView.enter
- 28. 与GMAP和离子框架
- 29. 恢复离子框架CSS
- 30. Javascript动画框架
我不知道我将如何去关于尝试此。通常情况下,我会在jQuery中做这些事情,但我在哪里写离子jquery! – 2014-12-02 22:19:55