简体   繁体   English

如何在网站上实现动画图像/图标?

[英]How to implement animated images/icons on a website?

I want to build a website with animated images, like the one in dropbox homepage: 我想建立一个带有动画图像的网站,例如Dropbox主页中的一个:

https://www.dropbox.com/ https://www.dropbox.com/

Another example is the intro images in treehouse homepage: 另一个例子是树屋首页中的介绍图片:

http://teamtreehouse.com/ http://teamtreehouse.com/

I think maybe I can use javascript and jQuery to dynamically change the images and their positions, but I am not sure. 我认为也许我可以使用javascript和jQuery动态更改图像及其位置,但是我不确定。 I wonder if there is any library or technology available to implement this kind of animation? 我想知道是否有任何库或技术可用于实现这种动画?

或者可以只在div中移动图像,也可以像下面这样使用SVG: 链接

For simple animations you probably want to use CSS animations to animate CSS properties like "left" or "top". 对于简单的动画,您可能希望使用CSS动画为CSS属性(例如“ left”或“ top”)设置动画。

@keyframes slidein {
  from { left: 450px; }
  to { left: 0; }
}

Example: http://codepen.io/anon/pen/eihJs 示例: http//codepen.io/anon/pen/eihJs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM