forked from bfl-itp/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
66 lines (56 loc) · 1.99 KB
/
scripts.js
File metadata and controls
66 lines (56 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* Created by Isi on 10/15/14.
*/
//
//var controller = new ScrollMagic({
// globalSceneOptions: {
// triggerHook: "onLeave"
// }
//});
//var pinning = new TimelineMax()
// .add(TweenMax.to("#this", 1, {transform: "translateY(0)"}))
// .add(TweenMax.to("#is", 1, {transform: "translateY(0)"}))
// .add(TweenMax.to("#how", 1, {transform: "translateY(0)"}))
// .add(TweenMax.to("#you", 1, {transform: "translateY(0)"}))
// .add(TweenMax.to("#tie", 1, {transform: "translateY(0)"}))
// .add(TweenMax.to("#slide", 1, {top: "0%", ease: Bounce.easeOut, delay: 0.2}))
// .add(TweenMax.to("#unpin",.5, {top: "100%"}));
//
//new ScrollScene({
// triggerElement: "div#pin",
// duration: 1100
//})
// .setTween(pinning)
// .setPin("#pin")
// .addTo(controller);
$(document).ready(function($) {
// define images
var images = [];
for (var i = 1; i < 64; i++){
images.push("howtotie/htt-" + (i) + ".jpg");
}
// TweenMax can tween any property of any object. We use this object to cycle through the array
var obj = {curImg: 0};
// create tween
var tween = TweenMax.to(obj, 0.5,
{
curImg: images.length - 1, // animate property curImg to number of images
roundProps: "curImg", // only integers so it can be used as an array index
repeat: 0, // repeat 3 times
immediateRender: true, // load first image automatically
ease: Linear.easeNone, // show every image the same amount of time
onUpdate: function () {
$("#shoe_seq").attr("src", images[obj.curImg]); // set the image source
}
}
);
// init controller
var controller = new ScrollMagic();
// build scene
var scene = new ScrollScene({triggerElement: "#trigger", duration: 400})
.setTween(tween)
.setPin("image_sequence")
.addTo(controller);
// show indicators (requires debug extension)
scene.addIndicators();
});