By default, transitions will appear linearly over time, but proper animations have a bit more customization to them by delaying when they start and controlling how slowly or quickly they move over time. animations:[ trigger('signal', [ state('void',…
When easing isn’t enough to get the exact animation you want, you can leverage keyframes to define and precise styles and steps over time. Keyframes allow you to achieve pretty much any Angular 2 animation you want. animations:[ trigger('signal', [ s…
Each trigger starts with an “undefined” state or a “void” state which doesn’t match any of your currently defined states. You have to be aware of when you’re in that state so that you don’t stumble on any undesired behaviors. This is especially impor…
今天写一个css动画时遇到一个有意思的问题,记录如下: 1.需求: 等待元素A的动画加载完,再加载B元素的动画(下图中A为大熊猫,B为下方卡片) 先来看下最后的效果啦: 2.初始思路: 在B元素的动画属性上加上delay(延迟,使得这个延迟时间 = A元素动画的加载时间) 即:animation : bmove .7s .7s 1; (这里的第二个.7s即delay时间0.7秒) b的动画过程代码如下: @keyframes bmove { 0% { margin-top: 100%; opac…
话不多说直接开讲: 1.需求: 等待元素A的动画加载完,再加载B元素的动画(下图中A为大熊猫,B为下方卡片) 先来看下最后的效果啦: 2.初始思路: 在B元素的动画属性上加上delay(延迟,使得这个延迟时间 = A元素动画的加载时间) 即:animation : bmove .7s .7s 1; (这里的第二个.7s即delay时间0.7秒) b的动画过程代码如下: @keyframes bmove { 0% { margin-top: 100%; opacity: 0 } 100% { ma…
创建项目之前需要先安装angular cli,(angular是用typescript编写的,所以先安装typescript,再安装angularjs-cli).打开命令窗口输入 npm install -g angular-cli ,等待安装完成,就可以打开webStorm创建项目了. 1.首先需要创建一个project. 可以看到图片上有两个关于Angular的选择.一个是AngularJS,这个创建的是基于Angular1.0版本类的project.另一个Angular CLI创建的才是基…
@Component({ selector: 'app-courses', templateUrl: './courses.component.html', styleUrls: ['./courses.component.css'], animations: [ trigger('courseHover', [ state('inactive', style({ backgroundColor: '#eee', transform: 'scale(1)' })), state('active'…
Inputs using Angular 2’s ngModel automatically apply style classes of .ng-validand .ng-invalid each time the input’s validity changes. These classes allow you easily add your own styles simply by declaring the styles in your Componentdecorator. impor…
Angular 2’s ActivatedRoute allows you to get the details of the current route into your components. Params on the ActivatedRoute are provided as streams, so you can easily map the param you want off of the stream and display it in your template. For…
You can easily show the user which route they are on using Angular 2’s routerLinkActive. Whenever a route matches the routerLink defined on the element, then the routerLInkActive will add the class that you assign it to. See Doc app.component.ts: imp…