Git Product home page Git Product logo

smooth-resize's Introduction

Smooth animations while the window is being resized

Responsive online graphics may need to update in response to changes in window size. It’s common to do this by listening for the resize event on the window object, but this results in a choppy effect since the resize event is not triggered frequently enough for a smooth animation.

This module makes it easy to implement smooth resize animations. While the window is being resized it uses requestAnimationFrame to run your drawing function at a (hopefully) decent frame rate.

It’s designed to be used with an ES6 module bundler such as rollup.js with rollup-plugin-node-resolve:

import smoothResize from "smooth-resize";

smoothresize(function(width, height) {
	// Redraw at the specified size
});

or you can include a self-contained version directly in your HTML:

<script src="https://cdn.flourish.rocks/smooth-resize-v0.min.js"></script>

It’s self-contained and tiny. Even the non-minified version is smaller than 1k.

It was developed for use in Flourish templates, but it’s open source and you can use it for anything.

smooth-resize's People

Contributors

robinhouston avatar

Stargazers

Cat  avatar Sam Wray avatar

Watchers

James Cloos avatar  avatar Daan Louter avatar Duncan Clark 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.