Is there an Angular 2 way to animate between classes?
<div class="home-carousel-head" id="full-screen-carousel" [ngClass]="{tab_one: tab_one, tab_two: tab_two, tab_three: tab_three}">
I want to fade out or fade in when the class changes between each tab, this was easy with Angular 1 and ng-animate but I am not seeing this functionality with Angular 2. What is the best practice in Angular 2 to accomplish this?
The Angular animation module is about to be shipped. Currently you can use CSS animation. Fade-in/fade-out should be quite easy using CSS alone.
Related
I'm trying to run an animation based on scroll in the background of a React app.
I use Threejs with React Three Fiber. In R3F, there is a hook called useScroll which I want to use.
Problem is that my Threejs scene (a Canvas) is in the background with zIndex: -100, so the scroll handler doesn't get the user input.
If I remove the zIndex property, everything works, but It's not what I want.
The scene look like this demo, the only difference is that mine has element in front.
I don't know if the solution is to use a different css style or something more complexe to allow the handler to do his job. I've been looking at React Portal but I don't think it will work.
Any ideas ?
Thanks in advance.
In my Ionic 4 app there's an ion-split-pane. Inside the ion-split-pane there's a ion-router-outlet where goes my ionic page.
Inside the page we are trying to implement a kanban with columns. We are trying to implement the capacity to move itens among columns using drag and drop.
But when there is horizontal scroll, in the place where the columns are inside, we cannot drop the itens.
We are using Angular Material's drag and drop.
How can we implement a drag and drop inside a scrollpane in a ionic split pane?
Well, in GitHub I could find you 2 sample projects that make a simple Kanban Board with Angular 7 + MD Controls ;)
1-) GitHub - Kanban Board (works!)
Screenshot:
2-) GitHub - kanban
These may not use the native components of Ionic, but the logic is the same: Only the controls vary from one another.
Check out the source and I hope you find it useful. ;)
Best regards.
It seems the problem is related/caused by ion-router-outlet. By replacing it with router-outlet the drag and drop started to work.
I'd like to animate some CSS styles not supported by {N}.
For example, text-color, height of an element etc.
Any suggestions, ideas as to how this could be done.
A simple linear animation would be fine.
Thanks.
I’m trying to create a looping fade in/out effect for an image. It’s working in Chrome, but it doesn’t work in Firefox.
Here’s the code: http://jsfiddle.net/FTLJA/254/
(I did make it work with jQuery but that made the browser slow and flickery on Android phones, so I’m trying CSS instead.)
Thanks for any help.
Update: fixed.. please check the link again
Well, if ypu're only setting the WebKit properties (only #-webkit-keyframes and only -webkit-animation-...), then of course it will work only in WebKit and not in Firefox - add them with -moz prefix as well. Also remove the quotes around 'blink' to leave it just... blink and it works http://jsfiddle.net/FTLJA/261/
Ah yes — this shows a difference between CSS transitions and CSS animations.
CSS animations run once you’ve applied -webkit-animation-name to an element, i.e. they can run entirely from CSS.
Transitions, on the other hand, only run when you change the CSS property that they apply to. You can either do this via CSS pseudo-classes like :hover, or via JavaScript.
So, in order to make your transition work in browsers that don’t support -webkit-animation, you’ll need to run some JavaScript that changes the opacity of the image once a second — setInterval is your friend here.
(Note that your JavaScript won’t carry out the animation, it’ll just switch opacity straight from 1 to 0 and back again every second. The CSS transition will animate this change for you.)
I have a dojo animation object of about 15 images. I'm also using dojo.fx.chain to link them all together.
Right before I create all my dojo.fadeIn's and dojo.fadeOut's I added in some basic javascript to preload each image.
My question is: Am I doing this the hard way or is there some function/attr I can set in the animation object to do this?
I do not think there is a predefined method in dojo to preload these images for your animation.
I guess you are listening image.onload and image.onerror events to preload images, it is a common method. If you feel it is too difficult and hard to control, you can try a simple clean css way that is to put an invisible div into your page and set background images with these animation images. When the page load, the images are automatically loaded.
dojo Animations are not specifically geared around images, they work on an abstract level and may operate on DOM nodes. So, there's no built-in support for IMG nodes specifically.
There is dojox.image.preload (http://api.dojotoolkit.org/jsdoc/HEAD/dojox.image.preload) which will do the work virsir suggested of loading images into an offscreen div, but it does not (currently) arrange an onLoad event hook for you to detect when they're loaded and thus play your animation.
I imagine you could use preload()'s return value and use it to hook into onLoad, but that's an exercise for the reader. Have a look at the source code, dojox/image/_base.js.