我可以在離子框架視圖中創建簡單的動畫。動畫將是非常簡單的動畫,比如改變顏色,褪色,增加元素的高度和寬度,就像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