1.1.2 • Published 5 years ago

@ziaomedia/vue-starwars v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Vue-starwars

A vue component that scrolls images in a Star Wars-esque manner.
(Ignore the framerate in the preview. The real thing runs at a smooth 60 fps.)

preview

Installing

yarn add vue-starwars
# or
npm install --save vue-starwars

Usage

Import the component either locally..

import StarWars from "@ziaomedia/vue-starwars";

export default {
    components: {
        StarWars
    }
}

.. or globally

import StarWars from "@ziaomedia/vue-starwars";
Vue.use(StarWars);

You can now use the <star-wars /> component. See the documentation for the supported options.
Note: When using Nuxt, you'll need to wrap the component in <no-ssr> tags.

Documentation

OptionTypeDefaultExplanation
images (required)arraystring-An array of images. The elements should be the URLs to the images you want to use.
backgroundstring#000000The background color of the component as a hex code.
placeholderstring-The location of the image to be used while the actual image is still loading
widthstring100%The width of the component. Valid options are things like 100%, 500px, 90vw, etc.
heightstring100%The height of the component. Valid options are things like 100%, 500px, 90vw, etc.
ratiofloat1.4The ratio of the tiles. A value of 1 represents a perfect square. Higher values make the tiles taller, while lower values make them wider
row-mininteger3The minimum number of tiles on a row, for mobile screens
row-maxinteger9The maximum number of tiles on a row, for massive screens
item-widthinteger250The target width (in pixels) of every tile. This is used to calculate the number of tiles that will be displayed per row.
speedfloat1A modifier to the speed. A value of 2 makes the tiles scroll by twice as fast.
spacinginteger3The spacing between tiles, in pixels.
anglefloat~0.62The angle, in radians, of the plane.

Todo

  • Keep track of the rows / columns so we don't recalculate everything when the element resizes.
  • Negative speed to go backwards.
  • Take DPI into account.
  • Calculate perspective based on size instead of fixed. (Instead, you are able to pass an angle now)
  • Get rid of the 'rows' concept?
  • Tilt-shift blur
  • Disable the gradient with a prop
  • Set the perspective/rotation with a prop

Projects using this component

I'd love to see what you make with this. Shoot me a line to have your project added!

  • ...
  • ...

License

This project is licensed under the MIT License - see the license.md file for details

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago