transition

How can I animate *ngFor in Angular?

橙三吉。 提交于 2019-11-27 23:00:49
I need to animate an ngFor list as it is populated and shown. Each element should have a transition, let's say something like this . How can I do that? Günter Zöchbauer It has a few issues because ngFor does a few redundant add/removes which cause items to be animated which shouldn't: import {Component} from 'angular2/core'; import { Component, Directive, OnDestroy, Input } from 'angular2/core'; @Component({ selector: 'my-app', template: `<div (click)="$event.preventDefault()"> <button type="button" (click)="pushItem()">Push</button> <button type="button" (click)="removeItemLast()">Remove Last

CSS: How to scale an image from the center instead of top-left

对着背影说爱祢 提交于 2019-11-27 22:09:29
So my problem is that I have an image and I set its CSS to have a max-width: 100% which scales it at lower resolutions ( as will be seen in the fiddle below ). What I want is for the transition to take effect from the center of the image. Currently; and from what I have seen from most the transitions I have done involving scale they expand from the top-left corner. here is my fiddle: http://jsfiddle.net/Eolis/3ya98xh8/3/ Just replace width: 400px; with transform: scale(2,2) on :hover . img { width: 100%; max-width: 100%; } div { position: absolute; left: 20%; top: 20%; width: 250px; transition

在Vue中如何快速实现小球动画

血红的双手。 提交于 2019-11-27 22:02:33
1. 在自己的页面中有做好相应的测试位置 2. 然后给小球添加属性 v-show并且添加相应的数据(false) 3.点击购物车 让 false = true; 4.然后到重点了; 用 transition的标签 把要运动的小球包起来 <transition @before-enter='beforeEnter' @enter='enter' @after-enter='afterEnter'> 小球 </transition> 5.在 methods 里 定义你上面写的方法: beforeEnter(el) {   el.style.transform = ' translate( 0,0 )' }, enter(el,done) {   el.offsetWidth;   el.style.transform = 'translate( 0,0 ) [ 这里写的是终点位置 , 上面是起始位置 ]   el.style.transition = 'all' 1s ease' ; }, afterEnter(el){   this.ballFlag = !this.ballFlag; [ 这里的ballFlag是 一个自己设定变量 true,或者 false ] } 6.这里 要在第五步的时候 把小球 的最终落点定好, 直接添加在第五步的 enter函数中; 这里有个好玩的页面是

fade between two UIButton images

故事扮演 提交于 2019-11-27 21:19:18
问题 i want to fade between two UIButton images for the purpose of setting favorites in a UITableView. Currently the transition is done without effect - it just changes the images directly on click/touch: trans_img = [UIImage imageNamed:@"fav_on.png"]; NSArray *subviews = [owningCell subviews]; UIButton *favbutton = [subviews objectAtIndex:2]; favbutton.imageView.animationImages = [NSArray arrayWithObjects:trans_img, nil]; [favbutton.imageView startAnimating]; Everything I found was a transition

iPhone Pushing View Controller in a left direction

て烟熏妆下的殇ゞ 提交于 2019-11-27 20:18:16
I have an app that has a centre view with two views off to each side of it. I want to have two navigation bar buttons, left and right which push a new navigation controller onto the view from the left or the right. When you change views by pushing a new view using the pushviewController: method of NavigationController, the view appears to slide in from the right. how do i change this to slide in from the left? Instead of using a navigation controller, I would just move the view. CGRect inFrame = [currentView frame]; CGRect outFrame = firstFrame; outFrame.origin.x -= inFrame.size.width; [UIView

CSS Transition doesn't work with top, bottom, left, right

妖精的绣舞 提交于 2019-11-27 19:57:13
I have an element with style position: relative; transition: all 2s ease 0s; Then I want to change its position smoothly after clicking on it, but when I add the style change the transition doesn't take place, instead the element moves instantly. $$('.omre')[0].on('click',function(){ $$(this).style({top:'200px'}); }); However if I change the color property for example, it changes smoothly. $$('.omre')[0].on('click',function(){ $$(this).style({color:'red'}); }); What might be the cause of this? Are there properties that aren't 'transitional'? EDIT : I guess I should have mentioned that this is

Change and transition dataset in chord diagram with D3

独自空忆成欢 提交于 2019-11-27 18:50:54
I'm working on a chord diagram using D3. I am trying to make it so that when a user clicks on a link the dataset will change to another predefined dataset. I've looked at both http://exposedata.com/tutorial/chord/latest.html and http://fleetinbeing.net/d3e/chord.html , and have tried to use some elements in there to get it to work. Here is the JavaScript to create the "default" diagram: var dataset = "data/all_trips.json"; var width = 650, height = 600, outerRadius = Math.min(width, height) / 2 - 25, innerRadius = outerRadius - 18; var formatPercent = d3.format("%"); var arc = d3.svg.arc()

LibGDX inside Android Activity

陌路散爱 提交于 2019-11-27 17:52:22
问题 I'm in the middle of developing a small app for Android using the Android UI and activities for the most part of the interaction, however one key aspect requires the use of LibGDX (using 3D models and physics). I want to be able to click a button in my app (my "Activate" class) which will open the "AndroidApplication" class (my "Bobble" class) that initializes and runs all the LibGDX code. My problem is that I can't use an "Intent" to start an AndroidApplication class (only an Activity as far

d3.js how to dynamically add nodes to a tree

妖精的绣舞 提交于 2019-11-27 17:18:31
I am using a d3.js tree, and would like to add nodes dynamically, rather than pre-loading the entire tree. How would i modify the following in order to dynamically add additional JSON nodes when a node is clicked? (see link below, and code below) http://mbostock.github.com/d3/talk/20111018/tree.html So rather than pre-loading the entire tree, instead i would like to retrieve the child nodes only when the parent is clicked. I can retrieve the json for the child nodes in the toggle function, however i can't figure out how i can add them to the tree. var m = [20, 120, 20, 120], w = 1280 - m[1] -

Main Menu In Swift

走远了吗. 提交于 2019-11-27 16:24:11
I would like to create a main menu for my game in swift. I am using the following code: import SpriteKit class menuScene: SKScene { //Adding Start Button let startButton = SKSpriteNode(imageNamed: "playButton") override func didMove(to view: SKView) { //Temporary Background backgroundColor = SKColor.darkGray //Start Button startButton.position = CGPoint(x: size.width / 2, y: size.height / 2) addChild(startButton) } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { for touch in touches { let location = touch.location(in: self); //Finding location of touch if atPoint