0.0.5 • Published 4 years ago

pp-movable-scene v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

PP Movable Scene

This is good solution if you want create movable scene by mouse move.

Demo where you see nice used this plugin: https://perfectlyproject.pl

Installation:

npm i pp-movable-scene --save-dev

Usage:

import PPMovableScene from 'pp-movable-scene';
new PPMovableScene({
        selector: '#scene',
        animate: true,
        shapes: {
            1200: [
                {
                    type: 'example-shape-1',
                    left: 10,
                    top: 30,
                    ratio: 0.7,
                    speed: 900,
                    direction: 'invert'
                },
                {
                    type: 'example-shape-2',
                    left: 40,
                    top: 70,
                    ratio: 0.04,
                    speed: 500,
                }
            ],
            0: [
                {
                    type: 'example-shape-2',
                    left: 10,
                    top: 70,
                    ratio: 0.04,
                    speed: 500,
                }
            ]
        }
    });

Options:

OptionDescriptionType
selectorSelector where will be create scenestring
animateRandom animate for itemboolean
shapesList shapes in this place we have to define breakpoint which is used to upwards. For example it's working like media query min-width in cssarray

Options for shape object:

OptionDescriptionType
typeIs param which setup class for elementstring
top/leftStarted top/left position in percentinteger
ratioRatio is used to set how long shift will be when we mouse move in any directionfloat
speedSetup speed transition in millisecondsinteger
directionSetup direction, can be setup normal or invert, default is setup normalinteger

Methods:

MethodDescription
.stop()use when you want stop animation and effect for mousemove
.run()use when you used earlier .stop() and you want run again effect
0.0.5

4 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.0.0

6 years ago