Auto Generating Post Thumbnails With Node.JS

Every time I post an article, I create a thumbnail to go along with it. Often this part is the most tedious. I usually do it in Photoshop or another image editor. To try and make this easier, I've recently automated the generation of post thumbnails of this image with Javascript and Node.JS. In this tutorial we'll be looking at how you can generate your own article images automatically, using Node.JS and Canvas. The final code can be found in this Git Gist.

Here is an example of an image I generated using this method:

Slideshow with Filter Reveal Effect

I’d like to share a very simple, little effect with you. It’s just an idea for applying a filter effect on a slideshow when navigating between the images. This is really just a proof of concept, I haven’t made a second level interaction, so no content preview or such thing.

So I hope you enjoy just navigating between the slides and find some inspiration in this. The whole thing suffers from classitis, there’s lots of better ways to do this!

Thanks for checking by!

The post Slideshow with Filter Reveal Effect appeared first on Codrops.

Thumbnail Hover Effect with SVG Filters

Already a while back, we explored applying SVG filters to images that appear when hovering a menu item. Today I thought that it would be interesting to play with a similar effect on thumbnails.

So the idea is to hover a small image and apply an SVG filter to it while sliding in another element, a caption that covers the image.

This kind of animation adds that little special extra to a design component like this. I really hope you like it and that it inspires you for new ideas.

I’ve used a different filter on each one of the images, so you can get an idea on the different possibilities here.

Please download it and use it as you wish, and thanks for stopping by!

Let me know what you think of it @crnacura or @codrops.

The post Thumbnail Hover Effect with SVG Filters appeared first on Codrops.

Thumbnail to Full Width Image Animation

The other day I stumbled upon this fantastic animation by Akram Khalid which he also coded up as part of a tutorial on page transitions with React Router and Framer Motion. The GitHub repo can be found here. It’s a really beautiful design and I wanted to have a go on experimenting with it and animating the initial thumbnail view to a full image (with article), using only scale transforms.

I also wanted to add some smooth scrolling and on-scroll animations, so I’ve used Locomotive Scroll. The beautiful images are by DeMorris Byrd.

This is highly experimental and it turned out to be a complex process. But I hope it gives you some of sort idea and entry point of how to pull off these kind of animations without touching the width and height of an element.

The main idea behind this technique is to scale an element and then counter-scale the child. Paul Lewis and Stephen McGruer show how to do that on a menu using expand and collapse animations. Avoiding animating the width and height of an element helps keep performance in check.

So what we do is to initially set the scale of the content__intro wrapper to a value that will make it shrink to an exact size. Then we set a counter scale to the image. This will make the image maintain the same size as before. Then, we add another scale to the image, shrinking it also the to the target size.

<div class="content__intro content__breakout">
	<img class="content__intro-img" src="img/1.jpg" alt="Some image" />
</div>

Having the initial width and height of an element and also the target dimensions, we can calculate the scale values of the outer wrapper based on this:

let introTransform = {
    scaleX: imageSettings.imageWidthEnd / imageSettings.imageWidthStart,
    scaleY: imageSettings.imageHeightEnd / imageSettings.imageHeightStart,
    y: (winsize.height/2 - introRect.top) - introRect.height/2
};

We also move the element to be centered on the screen (y).

We define these initial (start) and target (end) dimensions as variable in our CSS:

body {
	...
	--image-height-start: 555px;
	--image-width-end: 260px;
	--image-height-end: 320px;
}

Our starting width is 100% of the viewport width, so we don’t need to set that here. The image will then have the following scale applied:

gsap.set(this.DOM.introImg, {
    scaleX: 1/introTransform.scaleX * imageSettings.imageWidthEnd / this.DOM.introImg.clientWidth,
    scaleY: 1/introTransform.scaleY * imageSettings.imageHeightEnd / this.DOM.introImg.clientHeight
});

1/introTransform.scaleX is the counter scale of the outer wrapper. The second value that we multiply makes sure that we scale the image down to our desired size, just like we did with the outer wrapper before.

And that’s the main idea behind the scaling magic.

I hope this gives you a starting point for these kind of tricky animations! Thank you for checking it out 🙂

The post Thumbnail to Full Width Image Animation appeared first on Codrops.

Draggable Menu with Image Grid Previews

After our little draggable image strip experiment, we wanted to explore using the dragging functionality on a menu. The idea is to show a large inline menu with some scattered thumbnails. The menu can be dragged and while doing so, the thumbnails get moved with an animation. Each menu item also changes the letters to show an outlined version. When clicking on the “explore” link under a menu item, the thumbnails move and enlarge to form a grid.

The animations are powered by TweenMax and we use Dave DeSandro’s Draggabilly.

Attention: Note that the demo is experimental and that we use modern CSS properties that might not be supported in older browsers.

The initial view looks as follows:

DraggableMenu_01

When clicking on the explore link, we animate all thumbnails to their place in a custom grid.

DraggableMenu_02

You can see it in action here:

DraggableMenu.2019-06-19 10_45_16_optimized

We hope you enjoy this menu and find it useful!

References and Credits

Draggable Menu with Image Grid Previews was written by Mary Lou and published on Codrops.