Awesome Demos Roundup #10

It’s really hard for us to keep up with the incredible pace of web creatives who bring out fantastic demos and experiments. This collection is yet another attempt to showcase what we believe to be the most inspiring demos that were released in the past couple of weeks. With #codevember and the arrival of GSAP 3, there’s lots of wonderful demos we can indulge into. We hope you enjoy this little roundup and pamper the creative coder in you!

Mandelbrot in box-shadow

12_153828

GSAP 3 ETC Variable Font Wave

12_153858

CSS Whack-a-Mole

CSSWhack-a-Mole

react-three-fiber untitled game

react-three-fiberuntitledgame

Bringing text to life v4

Bringingtexttolifev4

A matter of gravity

Amatterofgravity

Web Graphics Experiments 32

WebGraphicsExperiments32

Saturn

Saturn

Credit Card Form

CreditCardForm

Synthwave

Synthwave

Web Graphics Experiments 33

WebGraphicsExperiments33

2 de Noviembre – Día de Muertos

2deNoviembre-DiadeMuertos

Generative Haunts

GenerativeHaunts

Wire Typo

WireTypo

rupee in threejs

rupeeinthreejs

circle packing

circlepacking

Voronoi Malonie

VoronoiMalonie

dune buggy

dunebuggy

seastorm

seastorm

Fast and Slow | Vintage Projector Animation

FastandSlowVintageProjectorAnimation

Inspect This Snake

InspectThisSnake

react-three-fiber demo

react-three-fiberdemo

PureCSS Lace

PureCSSLace

BenDover

BenDover

light

light

Steam spooky house

Steamspookyhouse

OK

OK

CSS Grid: Restaurant Website

RestaurantWebsite

Flocked

Flocked

GLSL STUDY 7

GLSLSTUDY7

Infinity Machine

12_185733

#codevember AI snake!

codevemberAIsnake

DConstruct

DConstruct

Awesome Demos Roundup #10 was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #9

This latest collection of awesome demos is full of creative surprises and amazing experiments. From innovative typography effects to neon lights and superb UI components; there’s lots of new things to explore and marvel at. So we invite you to delve into this demo collection and get inspired.

We hope you enjoy this roundup!

Pure CSS Cake 100×50 Game

PureCSSCake100x50Game

Simple drag and drop example

simpledraganddropexample

Procedural Mountains

ProceduralMountains

Corpses

corpses

Endless Shape Runner of Few Lines

EndlessShapeRunnerofFewLines

Everything And Remember

EverythingAndRemember

3D Floating Typo

3DFloatingTypo

Bolt loader animation

Boltloaderanimation

upside down

upsidedown

Delaunay Stripes

DelaunayStripes

Raindrop

Raindrop

HSL Slider w/ React + CSS vars

HSLSliderwReactCSSvars

pinball like sparklers

pinballlikesparklers

rgbShiftSlider

rgbShiftSlider

80’s

80s

Multi Step Bootstrap Form with animations

MultiStepBootstrapFormwithanimations

Paper Quilling Art

PaperQuillingArt

Pure CSS Book Loader

PureCSSBookLoader

Animated Verbs III

AnimatedVerbsIII

WebGL Wavy Image Hover Reveal (TWGL)

WebGLWavyImageHoverRevealTWGL

Arrows Defense Game

ArrowsDefenseGame

Slinky Loader

SlinkyLoader

Revelation

Revelation

3D Boxes Loader CSS only

3DBoxesLoaderCSSonly

Rubber Slider

RubberSlider

Sketches – 60

Sketches-60

jonquil

jonquil

Directionally blooming words

Directionallybloomingwords

Download Button Animation

DownloadButtonAnimation

ctrlz

ctrlz

soothe

soothe

Interior Visualization

InteriorVisualization

lights

lights

Sketches – 61

Sketches-61

CSS Rock-Paper-Scissors

CSSRock-Paper-Scissors

Voronoi Slices

VoronoiSlices

A LONG WAY

ALONGWAY

chaos-ink

chaos-ink

Madness

Madness

MSDF Matcap metallic type

MSDFMatcapmetallictype

Balloon Slider

BalloonSlider

Bringing text to life

Bringingtexttolife

Awesome Demos Roundup #9 was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #8

The past month has been full of creative experimentation including WebGL goodness and lots of exciting animations, variable fonts playfulness and CSS layout magic. There’s much to discover and learn from.

We hope you enjoy this demo collection and get inspired!

Strandbeest walk

Strandbeest-walk

Blurry

Blurry

Call to Action Hype Man

Call-to-Action-Hype-Man

Sphere of Boxes

Sphere-of-Boxes-_-three

Rainbow Animation (RAF + Responsive)

Rainbow-Animation-RAF–Responsive

Fork This Nav

Fork-This-Nav

Day/Night Ambient Light Animation

DayNight-Ambient-Light-Animation

Mitosis

Mitosis

Tunnel

Tunnel

Animated Verbs

Animated-Verbs

Tornado

Tornado

Animated Portrait w/ GSAP 2.0

Animated-Portrait-w-GSAP-20

Color this sofa! – SVG + Blend Mode trick

Color-this-sofa-–-SVG–Blend-Mode-trick

Polygon Tree

Polygon-Tree

Delaunay

Delaunay

Zdog Colour Tunnel

Zdog-Colour-Tunnel

Sorry not Sorry

Sorry-not-Sorry

Sloping heart

Sloping-heart

Stencil

Stencil

Calculating PI Using Raindrops

Calculating-PI-Using-Raindrops

Color Collision

Color-Collision

Sketchpad

Sketchpad

3D Switch animation

3D-Switch-animation

Sunbeams

Sunbeams

Exploding Points

Exploding-Points

Enigma machine

Enigma-machine

Energy

Energy

Animated Verbs II

Animated-Verbs-II

CSS Grid: Magazine Layouts

Screen-Shot-2019-09-11-at-14.47.42

Pixi Sprite Bubbles

Pixi-Sprite-Bubbles

burn

burn

Shaded islands

Shaded-islands

Order confirm animation

Order-confirm-animation

Fix posture

Fix-posture

Dissolve

DissolveShader

Awesome Demos Roundup #8 was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #7

So many awesome work has been done over the past month! There’s lots of demos and experiments that will make your jaw drop, that’s for sure. From procedurally generated CSS numbers to amazing CSS animations, there’s much to explore and wonder about.

We hope you enjoy this creative compilation!

Dandelion

Dandelion

Anime inspired self portrait

Anime-inspired-self-portrait

Walking Sprites Demo

Walking-Sprites-Demo

Ghibli Slider

Ghibli-Slider

∞ Loader animation

Loader-animation

Analog Clock in Three.js

Analog-Clock-in-Three

Toast Pop!

Toast-Pop

Wobbly underline

Wobbly-underline

Plasma

Plasma

Liquidfun

ShakeLiquidWindow

Kalli Hero

Kalli-Hero

Highway Race

Highway-Race

Cassie!

Cassie

anime.js grid staggering demo

AnimeJSStaggering

Distortion and Parallax Shader

DistortionParallaxShader

Fireworks

Fireworks

Grid Jr. (Web Audio API + Canvas visualizer)

Grid-Jr.-Web-Audio-API-+-Canvas-visualizer

Paint Drop Hover

Paint-Drop-Hover

Fishing Game

Fishing-Game

Clip Clop Clippity Clop

Clip-Clop-Clippity-Clop

Text by circles

Text-by-circles

Social Links Cube (PlayCanvas)

Social-Links-Cube-PlayCanvas

Color Search w/ React Hooks

Color-Search-wReact-Hooks

React Slider w/ Hover Effect

React-Slider-wHover-Effect

30 – 50 hogs

30—50-hogs

GLSL: 3D rotational spatial modification

GLSL-3D-rotational-spatial-modification

Procedurally Generated CSS Numbers

Procedurally-Generated-CSS-Numbers

Plibt

plibt

Glitched circles

glitched-circles

ThreeJS Hover Zoom Channel Displacement

ThreeJS-Hover-Zoom-Channel-Displacement

react-three-fiber: suspense + GLTF loader

threejs_PaulHenschel

Awesome Demos Roundup #7 was written by Mary Lou and published on Codrops.

Image Trail Effects

Today we’d like to share a fun mouse interaction effect with you that we found on the VLNC Studio website. The idea is to follow the mouse and show a trail of random images. It’s a kind of brutalist effect and there are various possibilities when it comes to showing and hiding the images. So we compiled a set of demos that explores different animations.

The animations are powered by TweenMax.

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

The main idea is to show the images quickly so that a trail forms along the movement of the mouse.

ImageTrailEffects_01

While there’s different ways to show the images, there’s also lots of room to play with the effects that make them disappear.

ImageTrailEffects_02

Demo 3 shows how we can make the images “drop” when they disappear:

ImageTrailEffects_03

We can also add a bit of a squeeze, too:

ImageTrailEffects_04

The last demo explores setting the size of the image to be fullscreen and restricting the movement to the sides only:

ImageTrailEffects_05

This effect is inspired by Ricky Michiels website.

Here’s a short GIF that shows the effect of demo 2 where we scale the images up and fade them out:

ImageTrailEffects.2019-08-07 11_22_55

We hope you enjoy these demos and find them useful.

References and Credits

Image Trail Effects was written by Mary Lou and published on Codrops.

Smooth Scrolling Image Effects

Picking up on our last tutorial on how to add smooth scrolling plus image animations to a page, we’d like to explore some more ideas for animations. We’ve made a small set of effects that show how you can apply some interesting transforms to elements like images and text while scrolling the page smoothly.

Inspirations for some of the effects come from Jesper Landberg’s smooth scroll with skew effect demo, Manuel Rovira’s Dribbble shot Lusaxweb Home and Jo Mor’s website.

The animations are powered by TweenMax.

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

For the demos, we’ve created different (grid) layouts with images that have decorative elements and captions.

We’ve used background images that are wrapped in a division with its overflow set to hidden, so that we can animate the scale or translate of the inner images in some examples. There are many possibilities to explore, for example, rotating the images:

SmoothScrollingEffects_01

…or adding a blend mode to one of the moving elements:

SmoothScrollingEffects_02

As you can also see in Jesper Landberg’s smooth scroll with skew effect demo, you can use the acceleration to control the transform amount. So when you scroll faster, the elements distort more.

Here’s a little GIF to show a detail of one of the animations:

smoothscrolleffect.2019-07-23 11_04_22

Note that when using the scale transform, the animations in Firefox don’t perform so smoothly.

We hope you enjoy this little set and find it inspirational.

References and Credits

Smooth Scrolling Image Effects was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #6

Amazing code has been crafted this past month: from pixel works to astonishing CSS art, to magnificent fluids and musical window resize fun. Posing like a rockstar or firing lasers, there’s something creative for everyone in this collection of original experiments from around the web.

We hope you enjoy this collection as much as we do!

Webcam Air Guitar

Airguitar

Agency website POC

AgencywebsitePOC

Poster generator

Pixelshapes

Lasers

Lasers

Uni

Uni

CSS-only Animated Lantern

CSS-onlyAnimatedLantern

Variable Fonts | Compressa

VariableFonts

[wip] motion blur transition

wipmotionblurtransition

Zdog and Goo

ZdogandGoo

shape-outside

shape-outside–Face

React World!

ReactWorld!

DOODLE-PLACE

DOODLE-PLACE

Blood

Blood

Ocean

Ocean

Six circles – bees & bombs

sixcircles-bees&bombs

Web Camera 02

Webcam

Reaction Tiles

ReactionTiles

Pure CSS Only Portrait – Isla

PureCSSOnlyPortrait-Isla

Accumulation

Accumulation

Rock God Pose

Rockgodepose

AI Assistant Blob

AIAssistantBlob

Falling City

FallingCity

Crystal

crystal

Variable font animation

Variablefontanimation

Fluid Drive

fluiddrive

CSS Grid: Coupons!

CSSGridCoupons

The Kabaa Project

TheKabaaProject

Dots Loader

DotsLoader

Drag & Drop

Drag&Drop

Pipes w/ Zdog + GSAP

PipeswZdogGSAP

Fluids Geometry

fluids

Galaxy

threejs_postprocessingGalaxy

Upload Play & Pause animation

UploadPlay&Pauseanimation

Space Shooter game

SpaceShootergame

Musical Particles III

MusicalParticlesIII

Only CSS: Infinite Wave ?

InfiniteWave

Popup Trombone

PopupTrombone

Atomize

Atomize

Pure CSS Katy

Katie

3D Particle Tornado

Tornado

Blurry cat and trees

cat

Awesome Demos Roundup #6 was written by Mary Lou and published on Codrops.

How to Add Smooth Scrolling with Inner Image Animations to a Web Page

Today we want to show you how to add smooth scrolling in HTML with some additional subtle animations on images. With “smooth scrolling” we don’t mean smoothly scrolling to an element, but rather a smoothly animated kind of scrolling behavior. There are many beautiful examples of such smooth scrolling behavior on some recent websites, like Elena Iv-skaya, or Ada Sokół and the stunning site of Rafal Bojar, and many many others. The latter also has a very nice image animation that is synced with the scrolling. This kind of “inner” image animation adds another interesting layer to the whole scroll movement.

Why is this kind of smooth scrolling something you’d like to add to a web page? If you have ever animated something on scroll, you might have experienced that browsers have difficulties in displaying the incoming content jank-free; especially images may show tiny abrupt jumps on scroll. It just feel easy on the eye. To avoid that, we can use the trick of animating the content itself by translating it up or down instead of using the “native” scroll.

Smooth Scrolling

Jesper Landberg created some really great Codepen demos showcasing how smooth scrolling can be applied to different scenarios. The Smooth scroll with skew effect demo shows how to add a skew effect to images while (smooth) scrolling. Here you can also see how smooth scrolling with translating the content works: a content wrapper is set to position fixed with the overflow set to hidden so that its child can be moved. The body will get the height of the content set to it, so that we preserve the scroll bar. When we scroll, the fixed wrapper will stay in place while we animate the inner content. This trick makes a simple yet effective smooth scrolling behavior possible.

In our example we’ll use the following structure:

<body class="loading">
	<main>
		<div data-scroll>
			<!-- ... --->
		</div>
	</main>
</body>

The main element will serve as fixed, or “sticky”, container while the [data-scroll] div will get translated.

Inner Image Animation

For the inner image animation we need an image and a parent container that has its overflow set to “hidden”. The idea is to move the image up or down while we scroll. We will work with a background image on a div so that we can control the overflow size better. Mainly, we need to make sure that the image div is bigger than its parent. This is our markup:

<div class="item">
	<div class="item__img-wrap"><div class="item__img"></div></div>
	<!-- ... --->
</div>

Let’s set the styles for these elements. We will use a padding instead of a height so that we can set the right aspect ratio for the inner div which will have the image as background. For this, we use an aspect ratio variable so that we simply need to set the image width and height and leave the calculation to our stylesheet. Read more about this and other brilliant techniques in Apect Ratio Boxes on CSS-Tricks.

We set an image variable for the background image in the item__img-wrap class so that we don’t have to write too many rules. This does not need to be done like that, of course, especially if you’d like support for older browsers that don’t know what variables are. Set it to the item__img directly as background-image instead, if that’s the case.

.item__img-wrap {
	--aspect-ratio: 1/1.5;
	overflow: hidden;
	width: 500px;
	max-width: 100%;
	padding-bottom: calc(100% / (var(--aspect-ratio))); 
	will-change: transform;
}

.item:first-child .item__img-wrap {
	--aspect-ratio: 8/10;
	--image: url(https://tympanus.net/Tutorials/SmoothScrollAnimations/img/1.jpg);
}

.item:nth-child(2) .item__img-wrap {
	width: 1000px;
	--aspect-ratio: 120/76;
	--image: url(https://tympanus.net/Tutorials/SmoothScrollAnimations/img/2.jpg);
}

...

The div with the background image is the one we want to move up or down on scroll, so we need to make sure that it’s taller than its parent. For that, we define an “overflow” variable that we’ll use in a calculation for the height and the top. We set this variable because we want to be able to easily change it in some modified classes. This allows us to set a different overflow to each image which changes the visual effect subtly.

.item__img {
	--overflow: 40px;
	height: calc(100% + (2 * var(--overflow)));
	top: calc( -1 * var(--overflow));
	width: 100%;
	position: absolute;
	background-image: var(--image);
	background-size: cover;
	background-position: 50% 0%;
	will-change: transform;
}

.item__img--t1 {
	--overflow: 60px;
}

.item__img--t2 {
	--overflow: 80px;
}

.item__img--t3 {
	--overflow: 120px;
}

Now, let’s do the JavaScript part. Let’s start with some helper methods and variables.

const MathUtils = {
    // map number x from range [a, b] to [c, d]
    map: (x, a, b, c, d) => (x - a) * (d - c) / (b - a) + c,
    // linear interpolation
    lerp: (a, b, n) => (1 - n) * a + n * b
};

const body = document.body;

We will need to get the window’s size, specifically it’s height, for later calculations.

let winsize;
const calcWinsize = () => winsize = {width: window.innerWidth, height: window.innerHeight};
calcWinsize();

We will also need to recalculate this value on resize.

window.addEventListener('resize', calcWinsize);

Also, we need to keep track of how much we scroll the page.

let docScroll;
const getPageYScroll = () => docScroll = window.pageYOffset || document.documentElement.scrollTop;
window.addEventListener('scroll', getPageYScroll);

Now that we have these helper functions ready, let’s get to the main functionality.
Let’s create a class for the smooth scrolling functionality.

class SmoothScroll {
    constructor() {
        this.DOM = {main: document.querySelector('main')};
        this.DOM.scrollable = this.DOM.main.querySelector('div[data-scroll]');
        this.items = [];
        [...this.DOM.main.querySelectorAll('.content > .item')].forEach(item => this.items.push(new Item(item)));
        
        ...
    }
}

new SmoothScroll();

So far we have a reference to the main element (the container that needs to become “sticky”) and the scrollable element (the one we will be translating to simulate the scroll).

Also, we create an array of our item’s instances. We will get to that in a moment.

Now, we want to update the translateY value as we scroll but we might as well want to update other properties like the scale or rotation. Let’s create an object that stores this configuration. For now let’s just set up the translationY.

constructor() {
    ...

    this.renderedStyles = {
        translationY: {
            previous: 0, 
            current: 0, 
            ease: 0.1,
            setValue: () => docScroll
        }
    };
}

We will be using interpolation to achieve the smooth scrolling effect. The “previous” and “current” values are the values to interpolate. The current translationY will be a value between these two values at a specific increment. The “ease” is the amount to interpolate. The following formula calculates our current translation value:

previous = MathUtils.lerp(previous, current, ease)

The setValue function sets the current value, which in this case will be the current scroll position.
Let’s go ahead and execute this initially on page load to set up the right translationY value.

constructor() {
    ...

    this.update();
}

update() {
    for (const key in this.renderedStyles ) {
        this.renderedStyles[key].current = this.renderedStyles[key].previous = this.renderedStyles[key].setValue();
    }   
    this.layout();
}

layout() {
    this.DOM.scrollable.style.transform = `translate3d(0,${-1*this.renderedStyles.translationY.previous}px,0)`;
}

We set both interpolation values to be the same, in this case the scroll value, so that the translation gets set immediately without the being animated. We just want the animation happening when we scroll the page. After that, we call the layout function which will apply the transformation to our element. Note that the value will be negative since the element moves upwards.

As for the layout changes, we need to:

  • set the position of the main element to fixed and the overflow to hidden so it sticks to the screen and doesn’t scroll.
  • set the height of the body in order to keep the scrollbar on the page. It will be the same as the scrollable element’s height.
constructor() {
    ...

    this.setSize();
    this.style();
}

setSize() {
    body.style.height = this.DOM.scrollable.scrollHeight + 'px';
}

style() {
    this.DOM.main.style.position = 'fixed';
    this.DOM.main.style.width = this.DOM.main.style.height = '100%';
    this.DOM.main.style.top = this.DOM.main.style.left = 0;
    this.DOM.main.style.overflow = 'hidden';
}

We also need to reset the body’s height on resize:

constructor() {
    ...

    this.initEvents();
}

initEvents() {
    window.addEventListener('resize', () => this.setSize());
}

Now we start our loop function that updates the values as we scroll.

constructor() {
    ...

    requestAnimationFrame(() => this.render());
}

render() {
    for (const key in this.renderedStyles ) {
        this.renderedStyles[key].current = this.renderedStyles[key].setValue();
        this.renderedStyles[key].previous = MathUtils.lerp(this.renderedStyles[key].previous, this.renderedStyles[key].current, this.renderedStyles[key].ease);
    }
    this.layout();
    
    // for every item
    for (const item of this.items) {
        // if the item is inside the viewport call it's render function
        // this will update the item's inner image translation, based on the document scroll value and the item's position on the viewport
        if ( item.isVisible ) {
            item.render();
        }
    }
    
    // loop..
    requestAnimationFrame(() => this.render());
}

The only new thing here is the call to the item’s render function which is called for every item that is inside the viewport. This will update the translation of the item’s inner image as we will see ahead.

Since we rely on the scrollable element’s height, we need to preload the images so they get rendered and we get to calculate the right value for the height. We are using the imagesLoaded to achieve this:

const preloadImages = () => {
    return new Promise((resolve, reject) => {
        imagesLoaded(document.querySelectorAll('.item__img'), {background: true}, resolve);
    });
};

After the images are loaded we remove our page loader, get the scroll position (this might not be zero if we scrolled the page before the last refresh) and initialize our SmoothScroll instance.

preloadImages().then(() => {
    document.body.classList.remove('loading');
    // Get the scroll position
    getPageYScroll();
    // Initialize the Smooth Scrolling
    new SmoothScroll(document.querySelector('main'));
});

So now that the SmoothScroll is covered let’s create an Item class to represent each of the page items (the images).

class Item {
    constructor(el) {
        this.DOM = {el: el};
        this.DOM.image = this.DOM.el.querySelector('.item__img');
        
        this.renderedStyles = {
            innerTranslationY: {
                previous: 0, 
                current: 0, 
                ease: 0.1,
                maxValue: parseInt(getComputedStyle(this.DOM.image).getPropertyValue('--overflow'), 10),
                setValue: () => {
                    const maxValue = this.renderedStyles.innerTranslationY.maxValue;
                    const minValue = -1 * maxValue;
                    return Math.max(Math.min(MathUtils.map(this.props.top - docScroll, winsize.height, -1 * this.props.height, minValue, maxValue), maxValue), minValue)
                }
            }
        };
    }
    ...
}

The logic here is identical to the SmoothScroll class. We create a renderedStyles object that contains the properties we want to update. In this case we will be translating the item’s inner image (this.DOM.image) on the y-axis. The only extra here is that we are defining a maximum value for the translation (maxValue). This value we’ve previously set in our CSS variable –overflow. Also, we assume the minimum value for the translation will be -1*maxVal.

The setValue function works as follows:

  • When the item’s top value (relative to the viewport) equals the window’s height (item just came into the viewport) the translation is set to the minimum value.
  • When the item’s top value (relative to the viewport) equals “-item’s height” (item just exited the viewport) the translation is set to the maximum value.

So basically we are mapping the item’s top value (relative to the viewport) from the range [window’s height, -item’s height] to [minVal, maxVal].

Next thing to do is setting the initial values on load. We also calculate the item’s height and top since we’ll need those to apply the function described before.

constructor(el) {
    ...
    
    this.update();
}

update() {
    this.getSize();
    for (const key in this.renderedStyles ) {
        this.renderedStyles[key].current = this.renderedStyles[key].previous = this.renderedStyles[key].setValue();
    }
    this.layout();
}

layout() {
    this.DOM.image.style.transform = `translate3d(0,${this.renderedStyles.innerTranslationY.previous}px,0)`;
}

getSize() {
    const rect = this.DOM.el.getBoundingClientRect();
    this.props = {
        height: rect.height,
        top: docScroll + rect.top 
    }
}

We need the same for when the window gets resized:

initEvents() {
    window.addEventListener('resize', () => this.resize());
}
resize() {
    this.update();
}

Now we need to define the render function called inside the SmoothScroll render loop function (requestAnimationFrame):

render() {
    for (const key in this.renderedStyles ) {
        this.renderedStyles[key].current = this.renderedStyles[key].setValue();
        this.renderedStyles[key].previous = MathUtils.lerp(this.renderedStyles[key].previous, this.renderedStyles[key].current, this.renderedStyles[key].ease);
    }
    this.layout();
}

This, as mentioned before, is only executed for items that are inside of the viewport. We can achieve this by using the IntersectionObserver API:

constructor(el) {
    ...

    this.observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => this.isVisible = entry.intersectionRatio > 0);
    });
    this.observer.observe(this.DOM.el);

    ...
}

And that’s it!

We hope you enjoyed this tutorial and find it useful!

How to Add Smooth Scrolling with Inner Image Animations to a Web Page was written by Mary Lou and published 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.

Animated Image Columns

Today we’d like to share a little layout with you. The idea is based on the current trend of a grid layout where the columns are animated. You can see this kind of animation in Aristide Benoist’s amazing design for Everest or Hrvoje Grubisic’s GETZ — Photography Portfolio Website concept. In our demo, we animate a decorative image grid and make the columns move away in an alternating way, revealing some content underneath. We use a playful hover effect for the menu items and mimic the animating when they fly away. We also added some slight mouse move interaction for the columns.

The animations are powered by TweenMax.

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 of the demo is the navigation with the decorative grid in the background.

AnimatedColumns_01

When clicking on one of the menu items, we animate the grid out by moving the columns in an alternating fashion, rotating them slightly. We mimic this behavior on the letters of the menu item.

When the grid moves away, the content area underneath is revealed:

AnimatedColumns_02

AnimatedColumns.2019-05-16 17_23_33

We hope you enjoy this experiment and find it useful!

References and Credits

Animated Image Columns was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #4

These past weeks have been filled with interesting experiments: code goodies from space, a distorted font generator and fantastic WebGL works are some of the highlights.

We hope you enjoy this compilation!

Solar CSSystem

Solar-CSSystem

ToneJS + canvas-sketch

ToneJS-canvas-sketch

Animated grid

animated-grid

Marine life

Marine-life

Woven sound

woven-sound

Only CSS: STARFOX Arwing Drone

Only-CSS-STARFOX-Arwing-Drone

Mouse grayscale WebGL displacement shader

Mouse-grayscale-webgl-displacement-shader

Only CSS: 3D Scan

Only-CSS-3D-Scan

Direction aware hover effect

Direction-aware-hover-effect

Melt

melt

Offf

offf

Rushing rapid in a forest by Three.js

33-_-Rushing-rapid-in-a-forest-by-Three

Musical Bubble Sort (CPC Bubble Sort)

Musical-Bubble-Sort-(CPC-Bubble-Sort)

Line Drawing

Line-Drawing.

Drag and Juuump!! and drop

Drag-and-Juuump-and-drop

Useless Machine

Useless-Machine

Mandala-3D

Mandala-3D

gl22

gl22

Motion detection with camera feed

motioncamera

Sun & Earth

Sun-&-Earth

enFont Terrible

enfont

Canvas Cloud

Canvas-Cloud

Rocket Through Space

Rocket-Through-Space

Awesome Demos Roundup #4 was written by Mary Lou and published on Codrops.

How to Create and Animate Rotated Overlays

Today we’d like to explore a specific reveal effect with you. If you saw the Crossroads Slideshow a while back, you might have noticed the page transition when the content is shown after an image gets clicked. We call this type of transitions a “reveal” animation because some content is already there while an overlay element animates out, revealing what’s underneath.

To make such an effect is pretty straightforward: simply place an overlay with the same or different color of the page background and animate it out of the viewport; whatever is under it will show. But there are two challenges here: one is if you’d like the overlay itself to have some content which you want to conceal, i.e. which you want to get cut off while hiding it and not simply move along with the parent when animating it out. The other challenge is to add a rotation and guarantee that the overlay covers the whole screen so that no gaps are shown when you move it out. When combining these two effects, things get really interesting.

So let’s tackle these two challenges in this little tip today and show some of the many possibilities for how to use these techniques in a page design.

The demos are kindly sponsored by Northwestern: Earn your MS degree entirely online. If you would like to sponsor one of our demos, find out more here.

Attention: Highly experimental prototyping, please view in a capable browser.

The reveal effect

The beauty of the reveal effect is that the technique is very simple, yet the result is so interesting: take any element that has its overflow set to “hidden” and animate it in some direction, while animating its child in the opposite direction. This creates a “cut off” look, the content appears to be steady in one place, as if we’re animating some kind of clipping mask. Yet we are only translating elements.

Under the hood, you can see what’s happening here:

Reveal_step1.2019-04-18 15_09_21

We simply move a container up. Now, let’s keep the content in place by reversing that movement and translating it in the opposite direction:

Reveal_opposite.2019-04-18 15_09_21

One last step is to add overflow: hidden to the parent:

Reveal_final2019-04-18 15_09_21

And that’s it! Now, if you want to spice things up a bit, you can add a different duration or easing to the reverse element or other animations to the inner elements.

Adding a rotation

The effect becomes a little bit more complicated when we want to add a rotation. When we rotate an element it will create gaps and not cover the background entirely anymore. So we need to make sure that it’s width and height is set in such a way that when rotated, there are no gaps.

Technically, we’re want the (minimum) bounding box of a rotated rectangle.

The following Stackoverflow thread gave us the right formula for our case: How to scale a rotated rectangle to always fit another rectangle

We only need to find the correct width and height, so the following bit is interesting to us:

When you rotate an axis-aligned rectangle of width w and height h by an angle ɸ, the width and height of the rotated rectangle’s axis-aligned bounding box are:

W = w·|cos ɸ| + h·|sin ɸ|
H = w·|sin ɸ| + h·|cos ɸ|

(The notation |x| denotes an absolute value.)

Additionally, we have to make sure that we keep the previous structure in place and that we show the content straight. So we need to rotate the content back. To ease our animation and not tinker with calculations we avoid moving the rotated content, but instead we’ll use the resized container for the motion.

In total we will use three containers to achieve all that:

<div class="content content--first"><!-- only rotated -->	
	<div class="content__move"><!-- resized and moved -->
		<div class="content__reverse"><!-- reverse rotation -->
			<!-- ... -->
		</div>
	</div>
</div>

If you look at the x-ray view of one of the demos, you can see the rotation and calculation of the new width and height:

Revealers_xray

Given this structure, there are really endless possibilities for rotated reveal and overlay animations.

Reveal2.2019-04-18 16_26_24

Think of multiple overlays. Think of matching animations of the elements that are being revealed or the ones that get hidden.

Reveal3.2019-04-18 16_28_20

There’s so much to explore!

Reveal5.2019-04-18 17_56_58

Have a look at our little compilation, we hope you enjoy it!

How to Create and Animate Rotated Overlays was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #3

For this third Awesome Demos Roundup we’ve collected some mesmerizing animations and artful experiments. Among them are some great ideas that will get you thinking “how was it done?” and that will make you wanna tinker with the variables. Dive in and get some inspiration for your next side project.

Enjoy!

Magnet

magnet

Particles Field

Particles-Field

Art of Noise #6

Art-of-Noise-6

Potential Flow

Potential-Flow

The Cube

The-Cube

GLSL: Looping simplex noise

GLSL–Looping-simplex-noise

React App

React-App

CSS Grid: Floor Plan

CSS-Grid–Floor-Plan

Wolfenstein: Ray Tracing On using WebGL1

Wolfenstein

Bach SVG Music Animation

Bach-SVG-Music-Animation

Lumina

Lumina

Art of Noise #8

Art-of-Noise-8

The Plastic Ocean

The-Plastic-Ocean

Model transitions

Model-transitions

Multiscale Turing Patterns

Multiscale-Turing-Patterns

Magical Light Tunnel

Magical-Light-Tunnel

Naughts and Crosses 3

Naughts-and-Crosses-3

Alien Invasion by Gal Shir : Web Animation by Kono

Alien-Invasion-by-Gal-Shir

GRASS

GRASS

Unicode art gallery – Unicode art gallery

Unicode-art-gallery

Course Clear! (Splitting.js Demo)

Course-Clear!

Floating heart

Floating-heart

Nails

nails

Whirling

Whirling

GLSL: Blinn-phong shading

Blinn-phong-shading

Chasing

Chasing

Previous Roundups

Awesome Demos Roundup #1

AwesomeDemos1

Awesome Demos Roundup #2

AwesomeDemosRoundup2_featured

Awesome Demos Roundup #3 was written by Mary Lou and published on Codrops.

Crossroads Slideshow

Today we’d like to share an experimental slideshow with you. The main idea is to show three slides of a slideshow that is slightly rotated. The titles of each slide, which serve as a decorative element, overlay the images and are rotated in an opposing angle. This creates an interesting look, especially when animated. When clicking on one of the lateral slides, the whole thing moves, and when we click on the middle slide, we move everything up and reveal a content area.

The animations are powered by TweenMax.

Attention: Note that the demo is experimental and that we use modern CSS properties that might not be supported in older browsers. Edge has a problem with SVG data-uri cursors, so you won’t see the custom cursors in the demo there.

The initial view of the slideshow looks as follows:

CrossroadsSlideshow_01

When we click on the lateral slides, we can navigate. When clicking on the middle one, we open the respective content view for that item:

CrossroadsSlideshow_02

We also have a dark mode option:

CrossroadsSlideshow_03

CrossroadsSlideshow_04

Here’s how the animations look:

We hope you enjoy this slideshow and find it useful!

References and Credits

Crossroads Slideshow was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #2

In our second Awesome Demos Roundup we are featuring some great experiments including pure CSS goodness and WebGL wonders. Play evolution with Matthew Main’s “Kiss The Sky” or swing the racket in Jon Slater’s “CSS Only Tennis Game”. But above all, we hope you get inspired with this little selection.

Enjoy!

Morphed Sphere

Morphed-Sphere

Shooting Star

Shooting-Star

Bubbles (CodePen Circles Challenge)

bubbles

Randomly generated Pure CSS menu icons w/ markup and SCSS

Randomly-generated-Pure-CSS-menu-icons

Blob study

blobstudy

Loader turbulence

Loader-turbulence

Particles

Particles
Check out this tweet.

Blobby hill

blobby-hill

Portal

Portal

Our new land [SVG]

our-new-land-[SVG]

Polygon Surface

Polygon-Surface

WebGL Wonderland #5

WebGL-Wonderland-#5

Kiss The Sky

Kiss-The-Sky

WebGL Wonderland #7

WebGL-Wonderland-#7

Displacement Scroll

Displacement-Scroll

Trippy polygons

Trippy-polygons

CurveBall

CurveBall

CSS Scroll Snap: How Do I Look In This?

CSS-Scroll-Snap–How-Do-I-Look-In-This-

Waterfall

Waterfall

Physarum #5

physarum-#5

View the Github repo.

CSS Only Tennis Game

CSS-Only-Tennis-Game

Awesome Demos Roundup #2 was written by Mary Lou and published on Codrops.

Image Distortion Effects with SVG Filters

In our recent articles series on SVG Filter Effects, Sara has shown how powerful and versatile SVG filters can be. They allow for a plethora of unique effects. Today we would like to share three animated distortion effects that we apply to an image when hovering a text link. We use feTurbulence and feDisplacementMap to create different kinds of fragment and wave-like distortions. These kind of effects have become quite popular and there are many variations. Menu hover animations showing an image in the background have also been around for a while and you can see an example that we’re based upon on Sara Marandi’s website.

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

If you’d like to understand how SVG filters work and learn how to create your own effects, we highly recommend you read Sara’s series:

Have a look at the effects we’ve created for the demos:

SVGFilterHover01.2019-03-12 17_25_08

SVGFilterHover02

SVGFilterHover03

We hope you like these effects and find them useful!

References and Credits

Image Distortion Effects with SVG Filters was written by Mary Lou and published on Codrops.

Text Trail Effect

Today we’d like to share a little text effect for a slideshow with you. It’s based on the animation seen in the Dribbble shot Abstract is hiring. The idea is to show a trail of a text when transitioning between slides of a slideshow. The animations are made using TweenMax.

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

We’ve created five demos with different typography and effects for the images as we go from one slide to another. The text trail layout is made by using a flexbox container that will make the height of each text container shrink so that all fit into the viewport (height). Some of the texts will be visible in full height (we set them specifically to flex: none). Using blend modes and rotations also creates an interesting look.

TextTrailEffect_01

TextTrailEffect_02

TextTrailEffect_03

TextTrailEffect_04

TextTrailEffect_05

We hope you enjoy this effect and find it useful!

References and Credits

Text Trail Effect was written by Mary Lou and published on Codrops.

Awesome Demos Roundup #1

If you read our Collective, you know that we usually add some interesting demos to every issue. In this new series we want to gather and showcase the most original demos and experiments from around the web. It’s a great way to see what exciting new technologies are emerging and how they can be put to use. We hope you find this interesting and inspiring! Enjoy!

Twintail

Twintail

Birthday Pure CSS Pen

Birthday-Pure-CSS-Pen

Paint on Mouse Move

Paint-on-Mouse-Move

All Gone (No Escape)

All-Gone-(No-Escape)

Web A Skeb

Web-A-Skeb

2019 – with love from Mazarine

Mazarine

Infinite SVG Triangle Fusion

Infinite-SVG-Triangle-Fusion

Coalesce 12 – Phosphorescence 6

Coalesce-12—Phosphorescence-6

CSS Grid: Train Ticket

Train-Ticket

Double exposure depth experiment

Double-exposure-depth-experiment

Layered Water

Layered-Water

Cycle #2, pure CSS tetrahedron

tetrahedron

Volume Controlled Variable Fonts!!!!

Screen-Shot-2019-02-14-at-18.06.03

Animated Boxes (three.js + anime.js)

Animated-Boxes-(three.js-+-anime.js)

Interactive Cube

Interactive-Cube

WebAudio Synth

WebAudio-Synth

Playing with sound and three.js

Playing-with-sound-and-threejs

Interactive 3D ASCII scenes

Interactive-3D-ASCII-scenes

Third Attempt at a Fire Shader

Third-Attempt-at-a-Fire-Shader

Bubble Toggle

Bubble-Toggle

Oddity Iteration n°2

Oddity-Iteration-n°2

rymd

rymd
Also, check out rymdkrig and find the source code here

Liquify your SVGs!

Liquify-your-SVGs!

Solar System 3D Animation (Pure CSS)

Solar-System-3D-Animation-(Pure-CSS)

CSS (on hover) animated SVG icons

CSS-(on-hover)-animated-SVG-icons

#CodepenChallenge Canvas Times Tables (Circles)

#CodepenChallenge-Canvas-Times-Tables-(Circles)

SVG Filters are 💕

SVG-Filters-are

Rainbow Tunnel

rainbowtunnel

Pure CSS Still Life – Water and Lemons

Still-Life

MIDI CITY 2000

MIDI-CITY-2000

Awesome Demos Roundup #1 was written by Mary Lou and published on Codrops.