I’ve seen things you people wouldn’t believe. Attack ships on fire off the shoulder of Orion. I watched c-beams glitter in the dark near the Tannhäuser Gate. All those moments will be lost in time, like tears in rain. Time to die. — Blade Runner
An animated sci-fi SVG scene demo using GreenSock heavily inspired by Blade Runner.
Visit the live demo on CodePen: https://codepen.io/enesser/full/BZQWBo/
I created this demo to get developers and designers excited about SVG animations at Designory.
SVGs:
- are generally lightweight compared to rasters
- can be described with
<desc/>
for accessibility - can be interactive
- are crisp at virtually any resolution and infinitely scalable
- can be great story-telling tools
The blimp’s display will rotate on demand if you click the blimp. This is meant to demonstrate that SVG elements can be interactive.
The following is a breakdown of all of the animations in the scene.
- Title (SplitText, TimeLineMax)
- Each letter fades in with
opacity
usingstaggerFrom
withPower1.easeIn
easing
- Each letter fades in with
- Clouds (TimeLineLite, TimeLineMax)
- Clouds translate along
x
, each on their own timeline
- Clouds translate along
- Blimp (TimeLineLite, TimeLineMax)
- Translates along
x
andy
, occasionally changingscale
to appear near or far - Lights change
opacity
andscale
usingstaggerFrom
- Glitch effect achieved using SVG
<filter/>
and SMIL<animation/>
- Blimp display shows and hides SVG elements for each frame with
display
property- Blimp rotates frames using requestAnimationFrame
- Translates along
- Beacon Lights (TimeLineLite)
- Lights change
opacity
usingfromTo
- Lights change
- Landing Lights (TimeLineMax)
- Lights change opacity using
staggerFrom
- Lights change opacity using
- Windows TimeLineMax
- Windows change
opacity
usingfrom
- Windows change
- Car (TimeLineMax)
- Sirens changes
opacity
usingto
- Traffic light changes SVG
fill
usingto
- Car translates
x
and changesscale
usingPower3.easeOut
to appear rubbery as it moves in a poor man’s attempt to follow the Principles of Animation
- Sirens changes
- Scanlines (keyframes, linear-gradient)
- Scanlines for an overall ’80s retro feel have been added using CSS
linear-gradient
animated with@keyframes
- Scanlines for an overall ’80s retro feel have been added using CSS
The most complex timeline in the scene is the car, and it was meant to demonstrate how to construct a complex animation by showing a car stopping at a traffic light, a traffic light changing from red to green, and the car resuming with its sirens on when the light changes.
If you are new to GreenSock, note that when you have multiple elements in a collection, to
or from
will animate them all at the same time, whereas staggerTo
and staggerFrom
will stagger the animation for each element so that they are spaced out from each other.
Staggering is used extensively for the animation of lights so they appear to twinkle in sequence.
GreenSock's Ease Visualizer can be a tremendous help when designing animation eases.
Special thanks:
- Аlexander Oblap for helping to create image assets.
- Glitch effect adapted from https://codepen.io/DirkWeber/pen/ArFvk
Copyright (c) 2017-2018 Eric J Nesser MIT