This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gsap from 'gsap' | |
| import store from '@/store' | |
| import Events from './Events' | |
| import { lerp } from '@/utils' | |
| const { isDevice, isDesktop } = store.flags | |
| export default new (class { | |
| constructor() { | |
| this.target = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Highway from '@dogstudio/highway' | |
| export default class extends Highway.Renderer { | |
| onEnter() { | |
| this.el = this.wrap.lastElementChild | |
| } | |
| onLeave() { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gsap from 'gsap' | |
| import { qs } from '@/utils' | |
| import { Events } from '@/events' | |
| export default class { | |
| ui = {} | |
| constructor(el = qs('[data-smooth-simple]'), content = null) { | |
| this.el = el |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gsap from 'gsap' | |
| import VirtualScroll from 'virtual-scroll' | |
| import Events from './Events' | |
| // Raf | |
| gsap.ticker.fps(-1) | |
| gsap.ticker.add(tick) | |
| function tick() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create 2 splits, one used to wrap the inner lines with overflow: hidden lines | |
| const outerSplit = new SplitText(title, { type: 'lines' }) | |
| const innerSplit = new SplitText(outerSplit.lines, { type: 'lines' }) | |
| new gsap.timeline({ | |
| onComplete: () => { | |
| // Remove wrappings when complete | |
| innerSplit.revert() | |
| outerSplit.revert() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gl { | |
| constructor() { | |
| Events.on('tick', this.run) // subscribe to globalraf ticker | |
| } | |
| run = ({ current }) => { | |
| /* | |
| Between routes I remove/add meshes from the scene, | |
| so I'm just updating the position of those currently in the scene |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gsap from 'gsap' | |
| class SimpleDraggable { | |
| constructor() { | |
| this.bindAll() | |
| this.el = document.querySelector('.js-slider-wrap') | |
| this.inner = this.el.querySelector('.js-slider-inner') | |
| this.slides = this.el.querySelectorAll('.js-slide') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class extends THREE.Object3D { | |
| init(el) { | |
| this.el = el | |
| this.resize() | |
| } | |
| resize() { | |
| this.rect = this.el.getBoundingClientRect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import e from '@unseenco/e' // Event emitter, I use my friend Jake's, since its great, but could also use TinyEmitter for example | |
| const Events = new e() | |
| export default Events |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const vertex = ` | |
| precision mediump float; | |
| attribute vec3 position; | |
| uniform mat4 modelViewMatrix; | |
| uniform mat4 projectionMatrix; | |
| varying vec2 vUv; |