为CSS Visual Filters and Transitions 的动画添加自定义加速度

来到新公司

前辈派给我的第一个任务是做一个类似outlook slider的小效果  可以把两个层的变化做成动画。

按照常理说  这个效果需要用flash来做  但是客户要求不能用脚本外的其他东西   幸好是针对ie开发  我想起来ie5.5 beta的新特性

DirectX filters(滤镜)了。没错 M$ 5年前就提供了这个现成的效果。IE啊  你这个让人又恨又爱的东西  你不这么强大又怎么会占这么多资源你。。。你该减肥了你。。。

具体可以参看

http://msdn.microsoft.com/en-us/library/ms673540(VS.85).aspx 

后面的Transitions都是动画效果哦

只要有本地msdn的同学 都可以在本地搜索

   CSS Visual Filters and Transitions

这个索引

 

恩 标准例子如下

 

Code

 

http://samples.msdn.microsoft.com/workshop/samples/author/filter/Slide.htm  点此直接察看效果

 

 

随后问题就来了   前辈要求的页面  并不是这样匀速直线的交换两个桢  而是因受力而加速的样子

这样  Play() 命令肯定是不足以胜任的。   仔细看看参考  我发现了一个不错的切入点 

 

 

Attributes/Properties
Show:
Attribute Property Description
bands bands Sets or retrieves the number of strips into which the content is divided during the transition.
duration Duration Sets or retrieves the length of time the transition takes to complete.
enabled Enabled Sets or retrieves a value that indicates whether the filter is enabled.
Percent Sets or retrieves the point in a transition at which to capture the display for a static filter output.
slideStyle SlideStyle Sets or retrieves the method used to reveal the new content.
status Retrieves the state of the transition.

 

恩。。。。 Percent。。。  看起来很淫荡

只要定时指派正确的percent  就可以控制速度了

我淫荡的笑了

 

于是有了下面的代码 

 

Code

 

 

 

恩  根据不同条件调整加速度  即可达成想要的各种效果   很有趣

 

 

这个故事告诉我们 

1 IE真臃肿阿,好多东西八百辈子永不到一次

2 IE真强大阿,虽然好多东西八百辈子永不到一次

3 知识不在新旧  用到的时候就是宝贵的知识

4 老知识也可以通过再学习发现新的用途

 

-0-  真是个啰嗦的大叔阿,写完了  希望对IE CSS感兴趣的弟妹们有帮助

 

posted @ 2008-11-18 16:02  MSFT:waywa 韦恩卑鄙  阅读(834)  评论(0编辑  收藏  举报