Giter Site home page Giter Site logo

kushgulati033 / hello-scrollytelling Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stitchfix/hello-scrollytelling

0.0 0.0 0.0 993 KB

A bare-bones version of the scrollytelling framework used in the Algorithms Tour

Home Page: https://stitchfix.github.io/hello-scrollytelling/

CSS 6.95% HTML 46.74% JavaScript 46.30%

hello-scrollytelling's Introduction

YO! Scrollytelling!

This is a bare bones version of the scrollytelling structure underlying the Stitch Fix Algorithms Tour, the full source code for which is here. It is based on Jim Vallandingham's concepts and code for scrollytelling with D3, which is explained here, demonstrated here and coded here.

In our Algorithms Tour, we used a lot of svg drawings and d3.timer-based animations, both of which are demonstrated here. Also included here is some math in svg, using a combination of Computer Modern fonts (the same fonts used as the Latex defaults) and outlined-path symbols where necessary - a minor hassle, as you can see, but not terrible.

Code

The description in this section is very similar to the one in the Algorithms Tour readme, but since this repo is a bare-bones version of the structure, it is somewhat simpler here. Apologies for being repetitive.

The figure below illustrates the overall structure. The two most important <div> elements are the #sections and #vis elements, which play the roles described in Jim Vallandingham's description: the #sections div contains a set of <section class="step"> elements that form the text column on the left, and whose positions determine which javascript functions are called when to manipulate the visual elements in the #vis div. These two <div>s are wrapped in a #graphic <div>, in keeping with Vallandingham's structure.

structure-illustration-1

If you take a quick gander at the index.html file, you will see a lot of svg syntax. The drawing elements within the <svg> constitute the landscape, sun, math and text. These svg elements were drawn in Adobe Illustrator (though any such graphical program could be used so long as it supports svg saving or export) and then simply pasted into the index.html file: this certainly bloats the file and is ugly to see in an html file, but it does make for a handy iterative workflow.

The first hierarchical level within the <svg> is composed entirely of <g> elements, each with an id that corresponds to the layer name in Illustrator and which gets referenced by the javascript functions that control the animation (e.g. by turning their display property on or off for different parts of the animation).

structure-illustration-1

For each <section class="step"> element in #sections (contained in index.html), there are two corresponding functions in conductor.js: an "activate" function, which is called when that section is scrolled into prominence (i.e. when the section above it reaches the top of the window); and a "progress" function, which is called for any scroll action within that section, and which uses the relative position within the section as a function parameter named progress.

Enjoy!

hello-scrollytelling's People

Contributors

bricof avatar kushgulati033 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.