0.1.9 • Published 5 years ago

canvas-spinner v0.1.9

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

Canvas-Spinner

A simple 3d product viewer made with vanilla JavaScipt and the HTML canvas element.

Installation

$ npm install --save canvas-spinner

Usage

import canvas-spinner into your project,

import CanvasSpinner from 'canvas-spinner'

create a canvas element in your HTML and give it an id.

<canvas id="canvas-spinner"></canvas>

pass canvas-spinner the following params: the canvas element, the images array of urls, and a boolean to determine whether you want a demo 360 degree spin to run on-load (default: False).

let spinner = new CanvasSpinner(imgSrc, canvas, true)

API

CanvasSpinner.currentFrame - reference to current frame in CanvasSpinner CanvasSpinner.totalFrames - returns total number of images stored

CanvasSpinner.update(direction: Number) - passing a value of -1 will spin product clockwise, passing 1 spins product counter-clockwise

CanvasSpinner.setFrame(frame: Number) - passing a number will display image with index matching the number value.

Key contributors:

@juegoman

License The MIT License (MIT)

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.0

5 years ago