Coder Social home page Coder Social logo

theryanhickman / cetandemscrollview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saggy/cetandemscrollview

1.0 2.0 0.0 11 MB

Allows you to lock Scroll/Scrollable Views together

License: Other

Objective-C 29.44% Python 52.23% JavaScript 18.33%

cetandemscrollview's Introduction

CETandemScrollView

This is a revamp of the Titanium TandemScroll module.

You can lock a number of ScrollViews or ScrollableViews together and proportionally scroll them. I've added a X,Y parallaxFactor, that allows you to play with the amount of scrolling.

This is an iOS only module

Quick Start

Get it gitTio

Download the latest distribution ZIP-file and consult the Titanium Documentation on how install it, or simply use the gitTio CLI:

$ gittio install co.coolelephant.tandemscroll

Usage

var win = Ti.UI.createWindow({
	backgroundColor: '#fff'
});

var TandemScroll = require('co.coolelephant.tandemscroll');
var scrollViews = [];
for (var i = 0; i < 3; i++) {
    var scrollView = Ti.UI.createScrollView({
        contentWidth: 1000 * (i + 1),
        contentHeight: 1000 * (i + 1)
    });
    scrollView.add(Ti.UI.createLabel({
        text: 'I am Scroll View ' + i,
        width: 160, height: 30,
        top: 200 + 70 * i, left: 200 + 40 * i
    }));
    scrollViews.push(scrollView);
    win.add(scrollView);
}
TandemScroll.lockTogether({
    views: scrollViews
});
scrollViews[scrollViews.length-1].addEventListener('scroll', function (evt) {
    Ti.API.info(evt.x + ',' + evt.y);
});
win.open();

There is a ScrollableView demo included with the module that shows how this could be used for an application introduction screen.

####Known Issues

  • If you use a ScrollableView, the paging control will not work

Options

views

Type: Array
Default: None (required)

Array of ScrollViews or ScrollableView to lock together (can be mixed).

parallaxFactorX

Type: Float
Default: 1 (optional)

Can be used to 'scale' the amount of scrolling in the x-direction, 1 is no scaling

parallaxFactorY

Type: Float
Default: 1 (optional)

Can be used to 'scale' the amount of scrolling in the y-direction, 1 is no scaling

Events

scroll

Fired when the view that is being touched scrolls

x

Type: Float The offset in the x direction the current view has moved

y

Type: Float The offset in the y direction the current view has moved

decelerating

Type: Boolean True if the scrolling view is decelerating

dragging

Type: Boolean True if the scrolling view is moving because of a user drag interaction

Changelog

  • v1.0
    • initial version

##ABOUT THE AUTHOR Cool Elephant is a front to back end system integration company with a special focus on mobile application design, development and integration. Titanium Appcelerator is one of our specialities!

web: Cool Elephant
twitter: @coolelephant
email: [email protected]

License

Copyright (c) 2010-2014 Cool Elephant Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

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.