├── .gitignore
├── README.md
├── demo
└── index.html
└── src
├── gsap-player.css
└── gsap-player.js
/.gitignore:
--------------------------------------------------------------------------------
1 | ### OSX ###
2 | *.DS_Store
3 | .AppleDouble
4 | .LSOverride
5 |
6 | # Icon must end with two \r
7 | Icon
8 | # Thumbnails
9 | ._*
10 | # Files that might appear in the root of a volume
11 | .DocumentRevisions-V100
12 | .fseventsd
13 | .Spotlight-V100
14 | .TemporaryItems
15 | .Trashes
16 | .VolumeIcon.icns
17 | .com.apple.timemachine.donotpresent
18 | # Directories potentially created on remote AFP share
19 | .AppleDB
20 | .AppleDesktop
21 | Network Trash Folder
22 | Temporary Items
23 | .apdisk
24 |
25 |
26 | ### Node ###
27 | # Logs
28 | logs
29 | *.log
30 | npm-debug.log*
31 |
32 | # Runtime data
33 | pids
34 | *.pid
35 | *.seed
36 | *.pid.lock
37 |
38 | # Directory for instrumented libs generated by jscoverage/JSCover
39 | lib-cov
40 |
41 | # Coverage directory used by tools like istanbul
42 | coverage
43 |
44 | # nyc test coverage
45 | .nyc_output
46 |
47 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
48 | .grunt
49 |
50 | # node-waf configuration
51 | .lock-wscript
52 |
53 | # Compiled binary addons (http://nodejs.org/api/addons.html)
54 | build/Release
55 |
56 | # Dependency directories
57 | node_modules
58 | jspm_packages
59 |
60 | # Optional npm cache directory
61 | .npm
62 |
63 | # Optional eslint cache
64 | .eslintcache
65 |
66 | # Optional REPL history
67 | .node_repl_history
68 |
69 | # Output of 'npm pack'
70 | *.tgz
71 |
72 | # Yarn Integrity file
73 | .yarn-integrity
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 📽 GSAP Player 📽
2 |
3 | A small, customizable YouTube-like player for GSAP (GreenSock) Timelines
4 |
5 | Project Demo Page: [http://s.codepen.io/sdras/debug/Mpjxxq/](http://s.codepen.io/sdras/debug/Mpjxxq/)
6 |
7 | 
8 |
9 | ## Usage
10 |
11 | The simplest possible use is loading gsap-player.js before the closing body tag (you do not need the CSS file) and implementing:
12 |
13 | ```js
14 | gsapPlayer({ playerTL: yourtimelinehere });
15 | ```
16 |
17 | This will append the player to document.body. The default timeline name is `tl`, if you're using tl, you only need to call `gsapPlayer();`
18 |
19 | ## Configurations
20 |
21 | ### Light Theme
22 |
23 | 
24 |
25 | GSAP Player will default to a dark theme, but you can also configure a light theme:
26 |
27 | ```js
28 | gsapPlayer({ light: true });
29 | ```
30 |
31 | ### Position
32 |
33 | By default, the GSAP player will be 80% wide and 40px from the bottom of the viewport. You can configure it to be full-width or flush to the bottom, or slightly higher or lower. Bottom must be in a string.
34 |
35 | ```js
36 | gsapPlayer({
37 | fullWidth: true,
38 | bottom: '0'
39 | });
40 | ```
41 |
42 | If you use full-width and keep the container defaulted to document.body, you should be sure that you've either used a reset or placed `margin: 0 ` on the body due to strange browser defaults.
43 |
44 | ### Container
45 |
46 | By default, the player is instantiated on the body, but if you'd like to change the parent, you can do:
47 |
48 | ```js
49 | gsapPlayer({ container: '#foo' });
50 | ```
51 |
52 | You'll need to put position: relative on that containing element to enclose the player spacially in that div. Just a heads up: this won't put the animation in the container as well (the configuration is kept separate for flexibility.
53 |
54 | ## License
55 |
56 | (The MIT License)
57 |
58 | Copyright (c)2017 Sarah Drasner [@sarah_edo](https://twitter.com/sarah_edo) All rights reserved.
59 |
60 | 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:
61 |
62 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
63 |
64 | 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.
65 |
66 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |