admin管理员组文章数量:1306063
I recently tried the Ken Burns effect with this little jQuery plugin: CrossSlide.
The problem with that plugin is that when the motion is too slow it looks really bad. This is due to the fact that the image can only move 1 pixel at the time...
I tried to do my own slideshow and I have the exact same problem. I then thought that this is normal... since we can only move an image pixel by pixel.
But I just found this slider: Estro Estro looks perfect to me. I wonder why it looks so smooth and how can I make mine look that good.
How can my Ken Burns effect be as good as Estro's one.
I recently tried the Ken Burns effect with this little jQuery plugin: CrossSlide.
The problem with that plugin is that when the motion is too slow it looks really bad. This is due to the fact that the image can only move 1 pixel at the time...
I tried to do my own slideshow and I have the exact same problem. I then thought that this is normal... since we can only move an image pixel by pixel.
But I just found this slider: Estro Estro looks perfect to me. I wonder why it looks so smooth and how can I make mine look that good.
How can my Ken Burns effect be as good as Estro's one.
Share Improve this question asked Dec 2, 2011 at 0:46 Jean-Philippe LeclercJean-Philippe Leclerc 6,8055 gold badges45 silver badges66 bronze badges3 Answers
Reset to default 2Without diving into the code for each one, if I were creating this I would use jQuery's animate() function. Using this function you can fine tune your slideshow by determining the distance and speed of the images' movement. For example this would move your image 50px to the up and to the left in 2 seconds:
$(".slideshow_image").animate({
'left': '-=50px',
'top': '-=50px',
'opacity': 0
}, 2000);
JS Code which uses HTML5 Canvas : http://www.willmcgugan./blog/tech/2011/2/26/ken-burns-effect-with-javascript-and-canvas/
I know it's a relatively old post, but I thought I'd reflect on it as I'm looking for the same answer.. Thanks for the Estro slider link, it's very smooth indeed, and I think I just found out how they do it: on top of the image tag they create an HTML5 canvas that lets you do basic 2D transformations - like dynamic resizing.
This way you don't need to worry about the fact that you can only handle full pixels. Also it might work without a canvas, but not using '-=50'-type animations, but scaling.
Have a look at KenBurner as an example.
I hope it helps some of you out there..
本文标签: javascriptHow to properly make a Ken Burns effect using JQueryStack Overflow
版权声明:本文标题:javascript - How to properly make a Ken Burns effect using JQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741815723a2399065.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论